Exemple #1
0
 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
     });
 }
Exemple #2
0
 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,
     });
 }