AI OnAI Off
Hi Mateusz,
You now create your Blocks using ViewComponents like so:
[ContentType(
DisplayName = "General Content Block",
GUID = "some-guid",
Description = "A super helpful description.",
GroupName = SystemTabNames.Content)]
public class GeneralContentBlock : BlockData, IContentBlock
{
// Block properties go here as normal
}
public sealed class GeneralContentBlockViewComponent : BlockComponent<GeneralContentBlock>
{
protected override IViewComponentResult InvokeComponent(GeneralContentBlock currentContent)
{
return View(currentContent);
}
}
Your Razor files are the same, except the default path is `/Views/Shared/Components/GeneralContentBlock/cshtml`
Hi,
We are in process of migrating from EPiServer to Optimizely 12 (.NET6), and have encountered this issue of partial view returned as an ActionResult in a controller.
previous code:
now in .Net6, there is still possibility to override `public override ActionResult Index` but `return PartialView(...)` is not recognized: "Cannot resolve symbol 'Partial View'".
Previously `EPiServer.Web.Mvc.BlockController` inherited from `ActionControllerBase : Controller`, now it is not, `EPiServer.Web.Mvc.PartialContentController` inherited from `PartialContentComponent` only, which does not have that method.
How shoud I approach that?