Skip to content

Instantly share code, notes, and snippets.

@simple17
Last active May 12, 2020 11:45
Show Gist options
  • Save simple17/f099e88cd470d0dc93e6e6975b2437ad to your computer and use it in GitHub Desktop.
Save simple17/f099e88cd470d0dc93e6e6975b2437ad to your computer and use it in GitHub Desktop.
[Get children] #episerver
private IContentRepository ContentRepository { get; }
public BlockController(IContentRepository contentRepository)
{
ContentRepository = contentRepository;
}
currentBlock.CallToActionSlides
?.FilteredItems
?.Select(x => ContentRepository.Get<IContent>(x.ContentLink) as CallToActionSlideBlock)
.Select(GetItemViewModel)
.ToList() ?? new List<CallToActionSlideBlockViewModel>()
private readonly IContentLoader _contentLoader;
////...
var children =
FilterForVisitor.Filter(
_contentLoader.GetChildren<TesArticlePage>(currentPageReference, LanguageSelector.AutoDetect()))
.OfType<TesArticlePage>()
.Select(this.toArticleListItem);
IEnumerable<ArticlePage> children =
DataFactory.Instance.GetChildren(pageLink)
.Where(child => child is ArticlePage)
.Cast<ArticlePage>();
IEnumerable<TesArticlePage> children = _contentLoader
.GetChildren<TesArticlePage>(currentPageReference, LanguageSelector.AutoDetect());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment