public static ArticleWithSideBarViewModel GetViewModel(Article article, ArticleWithSideBarProperties templateProperties, IPageUrlRetriever pageUrlRetriever, IPageAttachmentUrlRetriever attachmentUrlRetriever) { return(new ArticleWithSideBarViewModel { TeaserPath = article.Fields.Teaser == null ? null : attachmentUrlRetriever.Retrieve(article.Fields.Teaser).RelativePath, PublicationDate = article.PublicationDate, RelatedArticles = article.Fields.RelatedArticles.OfType <Article>().Select(relatedArticle => RelatedArticleViewModel.GetViewModel(relatedArticle, false, pageUrlRetriever, attachmentUrlRetriever)), Text = article.Fields.Text, Title = article.Fields.Title, SidebarLocation = (ArticleSidebarLocationEnum)Enum.Parse(typeof(ArticleSidebarLocationEnum), templateProperties.SidebarLocation, true), ArticleWidth = templateProperties.ArticleWidth, }); }
public static ArticleWithSideBarViewModel GetViewModel(Article article, ArticleWithSideBarProperties templateProperties) { return(new ArticleWithSideBarViewModel { Teaser = article.Fields.Teaser, PublicationDate = article.PublicationDate, RelatedArticles = article.Fields.RelatedArticles.OfType <Article>().Select((relatedArticle) => RelatedArticleViewModel.GetViewModel(relatedArticle, false)), Text = article.Fields.Text, Title = article.Fields.Title, SidebarLocation = (ArticleSidebarLocationEnum)Enum.Parse(typeof(ArticleSidebarLocationEnum), templateProperties.SidebarLocation, true), ArticleWidth = templateProperties.ArticleWidth, }); }