public IActionResult Delete(int id) { try { _deleteModelCommand.Execute(id); return(StatusCode(204)); } catch (EntityNotFoundException) { return(NotFound()); } }
public ActionResult Delete(int id, IFormCollection collection) { try { // TODO: Add delete logic here _deleteModel.Execute(id); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public ActionResult Delete(int id) { try { _delete.Execute(id); return(StatusCode(204)); } catch (EntityNotFoundException e) { return(NotFound(e.Message)); } catch (Exception e) { Console.WriteLine(e.Message); return(StatusCode(500)); } }
public IActionResult Delete(int id) { try { _deleteModelCommand.Execute(id); return(NoContent()); } catch (EntityNotFoundException e) { if (e.Message == "Model doesn't exist.") { return(NotFound(e.Message)); } return(UnprocessableEntity(e.Message)); } }