示例#1
0
        public ActionResult DeleteConfirmed(ViewModels.Comments.Delete model)
        {
            var comment = db.Comments.Find(model.Id);

            db.Comments.Remove(comment);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#2
0
        // 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));
        }