public ActionResult DeleteConfirmed(ViewModels.Comments.Delete model) { var comment = db.Comments.Find(model.Id); db.Comments.Remove(comment); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: Comments/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var comment = db.Comments.Find(id); if (comment == null) { return(new HttpStatusCodeResult(HttpStatusCode.NotFound)); } var model = new ViewModels.Comments.Delete(comment); return(View(model)); }