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,
     });
 }
Beispiel #2
0
 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,
     });
 }
 public static ArticleViewModel GetViewModel(Article article, IPageUrlRetriever pageUrlRetriever, IPageAttachmentUrlRetriever attachmentUrlRetriever)
 {
     return(new ArticleViewModel
     {
         PublicationDate = article.PublicationDate,
         RelatedArticles = article.Fields.RelatedArticles.OfType <Article>().Select(relatedArticle => RelatedArticleViewModel.GetViewModel(relatedArticle, true, pageUrlRetriever, attachmentUrlRetriever)),
         TeaserPath = article.Fields.Teaser == null ? null : attachmentUrlRetriever.Retrieve(article.Fields.Teaser).RelativePath,
         Text = article.Fields.Text,
         Title = article.Fields.Title
     });
 }
 public static ArticleViewModel GetViewModel(Article article)
 {
     return(new ArticleViewModel
     {
         PublicationDate = article.PublicationDate,
         RelatedArticles = article.Fields.RelatedArticles.OfType <Article>().Select((relatedArticle) => RelatedArticleViewModel.GetViewModel(relatedArticle, true)),
         Teaser = article.Fields.Teaser,
         Text = article.Fields.Text,
         Title = article.Fields.Title
     });
 }