Skip to content

Instantly share code, notes, and snippets.

@simple17
Created April 22, 2020 12:48
Show Gist options
  • Save simple17/22d2f06a0802d80293419e18136fb593 to your computer and use it in GitHub Desktop.
Save simple17/22d2f06a0802d80293419e18136fb593 to your computer and use it in GitHub Desktop.
[Get StartPage] #episerver
using System.Web.Mvc;
using EPiServer;
using EPiServer.Core;
using EPiServer.Framework.DataAnnotations;
using EPiServer.Web.Mvc;
using EPiServer.Web.Mvc.Html;
namespace Foundation.Features.Blocks
{
[TemplateDescriptor(Default = true)]
public class SomeBlockController : BlockController<SomeBlock>
{
private IContentRepository _contentRepository;
public SomeBlockController(IContentRepository contentRepository)
{
_contentRepository = contentRepository;
}
public override ActionResult Index(SomeBlock currentBlock)
{
var homePage = _contentRepository.Get<HomePage>(ContentReference.StartPage);
//...
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment