public IHttpActionResult Delete(int id) { if (awardDm.GetAwardByID(id) == null) { return(NotFound()); } else { awardDm.Delete(id); return(Ok()); } }
public ActionResult Delete(Award award) { try { ViewBag.Breadcrumb = new Breadcrumb("award", "delete", award.Title); var result = awardDm.Delete(award.ID); if (result) { return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Ошибка при удалении"); return(View()); } } catch (Exception ex) { ModelState.AddModelError("", $"{ex.Message}"); return(View()); } }