public Yield DeleteComment(DreamContext context, DreamMessage request, Result <DreamMessage> response)
        {
            PageBE    page    = null;
            CommentBE comment = null;

            GetCommentFromRequest(context, Permissions.ADMIN, out page, out comment);
            CommentBL.DeleteComment(page, comment);
            response.Return(DreamMessage.Ok());
            yield break;
        }
Exemple #2
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));
        }