Пример #1
0
        public void DeleteComment(DeleteCommentBm bind)
        {
            Comment comment = this.Context.Comments.Find(bind.CommentId);

            this.Context.Comments.Remove(comment);
            this.Context.SaveChanges();
        }
Пример #2
0
        public ActionResult Delete([Bind(Include = "CommentId")] DeleteCommentBm bind)
        {
            if (this.ModelState.IsValid)
            {
                this.service.DeleteComment(bind);
                return(this.RedirectToAction("All"));
            }

            DeleteCommentVm vm = this.service.GetDeleteVm(bind.CommentId);

            return(this.View(vm));
        }