public void DeleteComment(DeleteCommentBm bind) { Comment comment = this.Context.Comments.Find(bind.CommentId); this.Context.Comments.Remove(comment); this.Context.SaveChanges(); }
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)); }