/// <summary> /// Adds a BlogSummaryViewModel to the BlogViewModel /// </summary> /// <param name="summaryViewModel">summary view model</param> public void Add(FrontPageItemModel summaryViewModel) { if (summaryViewModel == null) throw new ArgumentNullException("summaryViewModel"); _summaries.Add(summaryViewModel); }
private void UpdateViewModelWithPosts(FrontPageModel viewModel, IEnumerable<BlogPost> blogPosts) { foreach (BlogPost post in blogPosts) { string parsedDescription = TransformWaneTextToHtml(post.Description); var summaryViewModel = new FrontPageItemModel { Title = post.Title, Description = parsedDescription, ImageUrl = post.ImageUrl, PublishedDate = post.PublishedDate, AuthorsName = post.Author.FullName }; viewModel.Add(summaryViewModel); } }