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