コード例 #1
0
 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);
 }
コード例 #2
0
 public void GivenANewPostsCollection_WhenIAccessTheCollection_ThenItIsTheSameAsTheSetValue()
 {
     var posts = new List<PostViewModel>();
     var model = new PostsViewModel();
     model.Posts = posts;
     Assert.That(model.Posts, Is.EqualTo(posts));
 }
コード例 #3
0
ファイル: PostController.cs プロジェクト: kevinrjones/mblog
 public virtual ActionResult Index(string nickname)
 {
     var postsViewModel = new PostsViewModel { Nickname = nickname };
     IList<Post> posts = _postService.GetBlogPosts(nickname);
     postsViewModel.AddPosts(posts);
     return View(postsViewModel);
 }
コード例 #4
0
ファイル: PostController.cs プロジェクト: kevinrjones/mblog
        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);
        }
コード例 #5
0
ファイル: PostController.cs プロジェクト: kevinrjones/mblog
 private ActionResult GetPosts(PostLinkViewModel model, IList<Post> posts, PostsViewModel postsViewModel)
 {
     if (IsSinglePost(model, posts))
     {
         postsViewModel.ShowComments = true;
     }
     postsViewModel.AddPosts(posts);
     return View("Show", postsViewModel);
 }
コード例 #6
0
 public void GivenAPostsViewModel_WhenIGetACollectionOfPostViewModels_ThenItIsInitialized()
 {
     var model = new PostsViewModel();
     List<PostViewModel> posts = model.Posts;
     Assert.That(posts, Is.Not.Null);
 }