Пример #1
0
 public IHttpActionResult Delete(int id)
 {
     if (awardDm.GetAwardByID(id) == null)
     {
         return(NotFound());
     }
     else
     {
         awardDm.Delete(id);
         return(Ok());
     }
 }
Пример #2
0
 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());
     }
 }