public IActionResult Delete(int id) { try { deleteMovie.Execute(id); return(StatusCode(204)); } catch (EntityNotFoundException e) { return(NotFound(new { Errors = new List <string> { e.Message } })); } catch (Exception e) { return(StatusCode(500, new { Errors = new List <string> { e.Message } })); } }
// GET: Movie/Delete/5 public ActionResult Delete(string id) { try { _deleteMovie.Execute(id); return(RedirectToAction(nameof(Index))); } catch { return(RedirectToAction(nameof(Index))); } }
public IActionResult Delete(string id) { try { _deleteMovie.Execute(id); return(NoContent()); } catch (EntityNotFoundException) { return(NotFound()); } catch { return(StatusCode(500)); } }
public IActionResult Delete(int id) { try { deleteMovie.Execute(id); return(NoContent()); } catch (EntityNotFoundException e) { return(UnprocessableEntity(e.Message)); } catch (Exception e) { return(StatusCode(500, e.Message)); } }
public ActionResult Delete(int id, MovieDTO collection) { try { deleteMovie.Execute(id); return(RedirectToAction(nameof(Index))); } catch (EntityNotFoundException e) { TempData["error"] = e.Message; } catch (Exception e) { TempData["error"] = e.Message; } return(View()); }