Example #1
0
        public ActionResult DeleteComment(int id)
        {
            CommentBL commentBL = new CommentBL();
            Comment   c         = commentBL.GetComments().Where(u => u.CommentId == id).Single();

            commentBL.DeleteComment(c);
            int postId = c.PostId;

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

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

            CommentsVM comVM = new CommentsVM();

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

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