public IActionResult Delete(int id) { try { deleteRole.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 IActionResult Delete(int id) { try { _deleteRole.Execute(id); return(StatusCode(204)); } catch (NotFoundException) { return(NotFound()); } }
public IActionResult Delete(int id) { try { _deleteRoleCommand.Execute(id); return(StatusCode(204, "Successfully deleted role.")); } catch (EntityNotFoundException) { return(NotFound()); } }
// GET: Roles/Delete/5 public ActionResult Delete(int id) { try { // TODO: Add delete logic here _deleteRole.Execute(id); return(RedirectToAction(nameof(Index))); } catch (Exception) { TempData["error"] = "Some error occured. Please try again."; return(RedirectToAction(nameof(Index))); } }
public ActionResult Delete(int id) { try { deleteRoleCommand.Execute(id); return(NoContent()); } catch (DataNotFoundException) { return(NotFound()); } catch (Exception) { return(StatusCode(500, "Server is busy at the moment, please try later")); } }
public ActionResult Delete(int id) { try { _deleteRole.Execute(id); return(StatusCode(200)); } catch (EntityNotFoundException e) { return(NotFound(e.Message)); } catch (Exception e) { return(StatusCode(500, e.Message)); } }
public IActionResult Delete(int id) { try { _deleteRoleCommand.Execute(id); return(NoContent()); } catch (EntityNotFoundException e) { return(NotFound(e.Message)); } catch (Exception) { return(StatusCode(500, "Server error")); } }
public ActionResult DeleteRole(int id) { try { _deleteRoleCommand.Execute(id); return(NoContent()); }catch (NotFoundException) { return(NotFound()); }catch (AlredyExistException) { return(StatusCode(422, "Role is alredy deleted")); }catch (Exception) { return(StatusCode(500, "Server error, try later")); } }
public ActionResult Delete(int id) { try { _deleteRoleCommand.Execute(id); return(NoContent()); } catch (EntityNotFoundException e) { return(NotFound(e.Message)); } catch (EntityDeleteForbiddenException e) { return(StatusCode(StatusCodes.Status403Forbidden, e.Message)); } catch (Exception e) { return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } }
public ActionResult Delete(int id) { try { _deleteRoleCommand.Execute(id); TempData["success"] = "Role deleted."; } catch (EntityNotFoundException e) { TempData["error"] = e.Message; } catch (EntityDeleteForbiddenException e) { TempData["error"] = e.Message; } catch (Exception e) { TempData["error"] = e.Message; } return(RedirectToAction(nameof(Index))); }