public IActionResult Delete(int id)
 {
     try
     {
         deleteUser.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 dynamic DeleteUser()
        {
            Guid userId = Request.Form["id"];

            _deleteUserCommand.Execute(userId);
            return(HttpStatusCode.OK);
        }
Exemple #3
0
        public void Execute_ValidationSucceeds_StatementsExecuted()
        {
            // execute
            _deleteUserCommand.Execute(Guid.NewGuid());

            // assert
            _dbContext.Received(1).ExecuteNonQuery(Arg.Any <string>(), Arg.Any <object>());
        }
Exemple #4
0
 public IActionResult Delete(int id)
 {
     try
     {
         _deleteUser.Execute(id);
         return(StatusCode(204));
     }
     catch (NotFoundException)
     {
         return(NotFound());
     }
 }
Exemple #5
0
 public IActionResult Delete(int id)
 {
     try
     {
         _deleteUserCommand.Execute(id);
         return(StatusCode(204, "Successfully deleted user."));
     }
     catch (EntityNotFoundException)
     {
         return(NotFound());
     }
 }
Exemple #6
0
 public IActionResult Delete(int id)
 {
     try
     {
         _deleteUsersCommand.Execute(id);
         return(NoContent());
     }
     catch (EntityNotFoundException)
     {
         return(Conflict("That news is already deleted."));
     }
 }
Exemple #7
0
 public ActionResult Delete(int id, IFormCollection collection)
 {
     try
     {
         _deleteUserCommand.Execute(id);
         return(RedirectToAction(nameof(Index)));
     }
     catch (EntityNotFoundException ex)
     {
         TempData["error"] = ex.Message;
         return(View());
     }
 }
 // GET: Users/Delete/5
 public ActionResult Delete(int id)
 {
     try
     {
         _deleteUser.Execute(id);
         return(RedirectToAction(nameof(Index)));
     }
     catch (Exception)
     {
         TempData["error"] = "Some error occurred. Please try again.";
         return(RedirectToAction(nameof(Index)));
     }
 }
 public IActionResult Delete(string id)
 {
     try
     {
         _deleteUser.Execute(id);
         return(NoContent());
     }
     catch (EntityNotFoundException)
     {
         return(Conflict());
     }
     catch
     {
         return(StatusCode(500, serverErrorMessage));
     }
 }
 public ActionResult Delete(int id)
 {
     try
     {
         _deleteUserCommand.Execute(id);
         return(NoContent());
     }
     catch (EntityNotFoundException e)
     {
         return(NotFound(e.Message));
     }
     catch (Exception e)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, e.Message));
     }
 }
 public IActionResult Delete(int id)
 {
     try
     {
         _deleteUser.Execute(id);
         return(NoContent());
     }
     catch (EntityNotFoundException e)
     {
         return(NotFound(e.Message));
     }
     catch (Exception)
     {
         return(StatusCode(500, "Server error"));
     }
 }
 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."));
     }
 }
Exemple #13
0
 public IActionResult Delete(int id)
 {
     try
     {
         deleteUser.Execute(id);
         return(NoContent());
     }
     catch (EntityNotFoundException e)
     {
         return(UnprocessableEntity(e.Message));
     }
     catch (Exception e)
     {
         return(StatusCode(500, e.Message));
     }
 }
Exemple #14
0
 public ActionResult <IEnumerable <UserDTO> > Delete(UserDTO dto)
 {
     try
     {
         _deleteUserCommand.Execute(dto);
         return(NoContent());
     }
     catch (EntityNotFoundException)
     {
         return(NotFound());
     }
     catch (Exception)
     {
         return(StatusCode(500));
     }
 }
Exemple #15
0
 public ActionResult Delete(int id)
 {
     try
     {
         _deleteUserCommand.Execute(id);
         return(NoContent());
     }
     catch (DataNotFoundException)
     {
         return(NotFound());
     }
     catch (Exception)
     {
         return(StatusCode(500, "Server is currently under construction, please try later"));
     }
 }
Exemple #16
0
 public ActionResult Delete(int id, UserDTO dto)
 {
     try
     {
         _deleteUser.Execute(dto);
         return(RedirectToAction(nameof(Index)));
     }
     catch (EntityNotFoundException)
     {
         return(View());
     }
     catch (Exception)
     {
         return(RedirectToAction("index"));
     }
 }
Exemple #17
0
 public IActionResult Delete(int id)
 {
     try
     {
         _deleteUser.Execute(id);
         return(Ok());
     }
     catch (EntityNotFoundException e)
     {
         return(NotFound(e.Message));
     }
     catch (Exception e)
     {
         return(StatusCode(500, e.Message));
     }
 }
Exemple #18
0
 public ActionResult Delete(int id)
 {
     try
     {
         _deleteUserCommand.Execute(id);
         return(StatusCode(204, "User is deleted"));
     }catch (AlredyExistException)
     {
         return(Conflict("User is alredy deleted"));
     }catch (NotFoundException)
     {
         return(NotFound());
     }catch (Exception)
     {
         return(StatusCode(500, "Server error, try later"));
     }
 }
Exemple #19
0
        public ActionResult Delete(int id)
        {
            try
            {
                _deleteUserCommand.Execute(id);
                TempData["success"] = "User deleted.";
            }
            catch (EntityNotFoundException e)
            {
                TempData["error"] = e.Message;
            }
            catch (Exception e)
            {
                TempData["error"] = e.Message;
            }

            return(RedirectToAction(nameof(Index)));
        }
Exemple #20
0
        public ActionResult Delete(int id, IFormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here


                _deleteUser.Execute(id);

                return(RedirectToAction(nameof(Index)));
            }
            catch (EntityNotFoundException e)
            {
                TempData["Errors"] = e.Message;
            }
            catch (Exception e) { TempData["Errors"] = e.Message; }

            return(View());
        }
Exemple #21
0
 public IActionResult Delete(int id)
 {
     try
     {
         _deleteCommand.Execute(id);
         return(NoContent());
     }
     catch (EntityNotFoundException)
     {
         return(NotFound());
     }
     catch (EntityDeleted)
     {
         return(StatusCode(410, "The Category is already Deleted"));
     }
     catch (Exception)
     {
         return(StatusCode(500, "An error occured"));
     }
 }
Exemple #22
0
 // GET: User/Delete/5
 public ActionResult Delete(string id)
 {
     _deleteUser.Execute(id);
     return(RedirectToAction(nameof(Index)));
 }
Exemple #23
0
        public IHttpActionResult DeleteUser(int id)
        {
            _deleteUserCommand.Execute(id);

            return(Ok());
        }
Exemple #24
0
 public IActionResult Delete(int id, [FromServices] IDeleteUserCommand command)
 {
     command.Execute(id);
     return(NoContent());
 }