public virtual ActionResult Index(AdminBlogViewModel model) { var blog = _blogService.GetBlog(model.Nickname); IList<Post> posts = _postService.GetOrderedBlogPosts(blog.Id); var postsViewModel = new PostsViewModel(model.Nickname, posts); return View(postsViewModel); }
public void GivenANewPostsCollection_WhenIAccessTheCollection_ThenItIsTheSameAsTheSetValue() { var posts = new List<PostViewModel>(); var model = new PostsViewModel(); model.Posts = posts; Assert.That(model.Posts, Is.EqualTo(posts)); }
public virtual ActionResult Index(string nickname) { var postsViewModel = new PostsViewModel { Nickname = nickname }; IList<Post> posts = _postService.GetBlogPosts(nickname); postsViewModel.AddPosts(posts); return View(postsViewModel); }
public virtual ActionResult Show(PostLinkViewModel postLinkViewModel) { var postsViewModel = new PostsViewModel { Nickname = postLinkViewModel.Nickname }; IList<Post> posts = _postService.GetBlogPosts(postLinkViewModel.Year, postLinkViewModel.Month, postLinkViewModel.Day, postLinkViewModel.Nickname, postLinkViewModel.Link); var modelStateDictionary = TempData["comment"] as ModelStateDictionary; if (modelStateDictionary != null) { ViewData.ModelState.Merge(modelStateDictionary); } return GetPosts(postLinkViewModel, posts, postsViewModel); }
private ActionResult GetPosts(PostLinkViewModel model, IList<Post> posts, PostsViewModel postsViewModel) { if (IsSinglePost(model, posts)) { postsViewModel.ShowComments = true; } postsViewModel.AddPosts(posts); return View("Show", postsViewModel); }
public void GivenAPostsViewModel_WhenIGetACollectionOfPostViewModels_ThenItIsInitialized() { var model = new PostsViewModel(); List<PostViewModel> posts = model.Posts; Assert.That(posts, Is.Not.Null); }