Пример #1
0
 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
             }
         }));
     }
 }
Пример #2
0
        public dynamic DeleteUser()
        {
            Guid userId = Request.Form["id"];

            _deleteUserCommand.Execute(userId);
            return(HttpStatusCode.OK);
        }
Пример #3
0
        public void Execute_ValidationSucceeds_StatementsExecuted()
        {
            // execute
            _deleteUserCommand.Execute(Guid.NewGuid());

            // assert
            _dbContext.Received(1).ExecuteNonQuery(Arg.Any <string>(), Arg.Any <object>());
        }
Пример #4
0
 public IActionResult Delete(int id)
 {
     try
     {
         _deleteUser.Execute(id);
         return(StatusCode(204));
     }
     catch (NotFoundException)
     {
         return(NotFound());
     }
 }
Пример #5
0
 public IActionResult Delete(int id)
 {
     try
     {
         _deleteUserCommand.Execute(id);
         return(StatusCode(204, "Successfully deleted user."));
     }
     catch (EntityNotFoundException)
     {
         return(NotFound());
     }
 }
Пример #6
0
 public IActionResult Delete(int id)
 {
     try
     {
         _deleteUsersCommand.Execute(id);
         return(NoContent());
     }
     catch (EntityNotFoundException)
     {
         return(Conflict("That news is already deleted."));
     }
 }
Пример #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());
     }
 }
Пример #8
0
 // 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)));
     }
 }
Пример #9
0
 public IActionResult Delete(string id)
 {
     try
     {
         _deleteUser.Execute(id);
         return(NoContent());
     }
     catch (EntityNotFoundException)
     {
         return(Conflict());
     }
     catch
     {
         return(StatusCode(500, serverErrorMessage));
     }
 }
Пример #10
0
 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));
     }
 }
Пример #11
0
 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"));
     }
 }
Пример #12
0
 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."));
     }
 }
Пример #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));
     }
 }
Пример #14
0
 public ActionResult <IEnumerable <UserDTO> > Delete(UserDTO dto)
 {
     try
     {
         _deleteUserCommand.Execute(dto);
         return(NoContent());
     }
     catch (EntityNotFoundException)
     {
         return(NotFound());
     }
     catch (Exception)
     {
         return(StatusCode(500));
     }
 }
Пример #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"));
     }
 }
Пример #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"));
     }
 }
Пример #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));
     }
 }
Пример #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"));
     }
 }
Пример #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)));
        }
Пример #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());
        }
Пример #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"));
     }
 }
Пример #22
0
 // GET: User/Delete/5
 public ActionResult Delete(string id)
 {
     _deleteUser.Execute(id);
     return(RedirectToAction(nameof(Index)));
 }
Пример #23
0
        public IHttpActionResult DeleteUser(int id)
        {
            _deleteUserCommand.Execute(id);

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