Last active
May 12, 2020 11:45
-
-
Save simple17/f099e88cd470d0dc93e6e6975b2437ad to your computer and use it in GitHub Desktop.
[Get children] #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
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>() |
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
private readonly IContentLoader _contentLoader; | |
////... | |
var children = | |
FilterForVisitor.Filter( | |
_contentLoader.GetChildren<TesArticlePage>(currentPageReference, LanguageSelector.AutoDetect())) | |
.OfType<TesArticlePage>() | |
.Select(this.toArticleListItem); |
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
IEnumerable<ArticlePage> children = | |
DataFactory.Instance.GetChildren(pageLink) | |
.Where(child => child is ArticlePage) | |
.Cast<ArticlePage>(); |
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
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