public IActionResult Delete(int id) { try { deleteComment.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 } })); } }
public ActionResult Delete(int id, IFormCollection collection) { try { _deleteCommentCommand.Execute(id); return(RedirectToAction(nameof(Index))); } catch (EntityNotFoundException ex) { TempData["error"] = ex.Message; return(View()); } }
public IActionResult Delete(int id) { try { _deleteCommand.Execute(id); return(NoContent()); } catch (EntityDeleted) { return(StatusCode(410, "The Comment is already Deleted")); } catch (Exception) { return(StatusCode(500, "An error occured")); } } //abcd
public ActionResult Delete(int id) { try { _deleteCommentCommand.Execute(id); return(NoContent()); } catch (EntityNotFoundException e) { return(NotFound(e.Message)); } catch (Exception e) { return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } }
public ActionResult Delete(int id) { try { _deleteComment.Execute(id); return(StatusCode(204)); } catch (EntityNotFoundException e) { return(NotFound(e.Message)); } catch (Exception e) { return(StatusCode(500, e.Message)); } }
public ActionResult Delete(int id) { try { deleteCommentCommand.Execute(id); return(NoContent()); } catch (DataNotFoundException) { return(NotFound()); } catch (Exception) { return(StatusCode(500)); } }
public ActionResult Delete(int id) { try { _deleteCommand.Execute(id); return(NoContent()); } catch (EntityNotFoundException e) { return(NotFound(e.Message)); } catch (Exception) { return(StatusCode(500, "Server error has occurred.")); } }
public ActionResult <IEnumerable <CommentDTO> > Delete(CommentDTO dto) { try { _deleteCommentCommand.Execute(dto); return(NoContent()); } catch (EntityNotFoundException) { return(NotFound()); } catch (Exception) { return(StatusCode(500)); } }
public IActionResult Delete(int id) { try { _deleteCommentCommand.Execute(id); return(NoContent()); } catch (EntityNotFoundException e) { if (e.Message == "Comment doesn't exist.") { return(NotFound(e.Message)); } return(UnprocessableEntity(e.Message)); } }
public ActionResult Delete(int id) { try { _deleteCommentCommand.Execute(id); TempData["success"] = "Comment deleted."; } catch (EntityNotFoundException e) { TempData["error"] = e.Message; } catch (Exception e) { TempData["error"] = e.Message; } return(RedirectToAction(nameof(Index))); }
public ActionResult Delete(int id, CommentDto dto) { try { _deleteCommand.Execute(id); return(RedirectToAction("Index")); } catch (EntityNotFoundException) { TempData["error"] = "Comment doesn't exist."; return(RedirectToAction(nameof(Index))); } catch (Exception) { TempData["error"] = "Error"; return(RedirectToAction(nameof(Index))); } }