Example #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Task task = db.Tasks.Find(id);

            if (!EntityAuthorization.TaskDelete(task))
            {
                return(HttpNotFound());
            }

            db.Tasks.Remove(task);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #2
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Task task = db.Tasks.Find(id);

            if (task == null)
            {
                return(HttpNotFound());
            }

            if (!EntityAuthorization.TaskDelete(task))
            {
                return(HttpNotFound());
            }

            return(View(task));
        }