Created
April 22, 2020 12:48
-
-
Save simple17/22d2f06a0802d80293419e18136fb593 to your computer and use it in GitHub Desktop.
[Get StartPage] #episerver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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