Example #1
0
        public ActionResult CommentList(CommentsVM comVM)
        {
            comVM.newComment.date = DateTime.Now;

            CommentBL commentBL = new CommentBL();

            commentBL.AddComment(comVM.newComment);
            int postId = comVM.newComment.PostId;

            comVM.commentsList = commentBL.FindComments(postId);
            comVM.commentsList.Reverse();

            PostBL      postBL = new PostBL();
            List <Post> list   = postBL.GetPosts();
            Post        post   = list.Where(u => u.PostId == postId).Single();

            post.numOfComments += 1;
            postBL.EditPost(post);

            return(PartialView("CommentList", comVM));
        }