コード例 #1
0
 // GET: ReplacementItems/Delete/5
 public ActionResult Delete(int id)
 {
     try
     {
         if (!_replacementItemsService.Delete(id))
         {
             ModelState.AddModelError("", "Cannot delete item");
         }
     }
     catch (ItemNotFoundException)
     {
         return(NotFound(id));
     }
     catch (Exception ex)
     {
         ModelState.AddModelError("", $"Something went wrong: {ex.Message}");
     }
     return(RedirectToAction(nameof(Index)));
 }