Exemplo n.º 1
0
 public IActionResult Delete(int id)
 {
     try
     {
         _deleteNewsCommand.Execute(id);
         return(NoContent());
     }
     catch (EntityNotFoundException)
     {
         return(Conflict("That news is already deleted."));
     }
 }
Exemplo n.º 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());
     }
 }