示例#1
0
 public IActionResult Delete(int id)
 {
     try
     {
         _deleteNewsCommand.Execute(id);
         return(NoContent());
     }
     catch (EntityNotFoundException)
     {
         return(Conflict("That news is already deleted."));
     }
 }
示例#2
0
 public ActionResult Delete(int id, NewsDto newsDto)
 {
     try
     {
         _deleteNewsCommand.Execute(id);
         return(RedirectToAction(nameof(Index)));
     }
     catch (EntityNotFoundException ex)
     {
         TempData["error"] = ex.Message;
         return(View());
     }
 }