public ActionResult Delete(int id) { try { _userApplicationService.Delete(id); return(Ok()); } catch (Exception ex) { return(BadRequest(new { message = ex.GetExceptionMessage() })); } }
public void UserApplicationService_Delete_without_permission() { var currentUser = new UserBuilder().WithProfile(ProfileType.Standard).Builder(); _userRepository.Add(currentUser); _unitOfWork.Commit(); _requestScope.SetUserId(currentUser.Id); var user = new UserBuilder().WithProfile(ProfileType.Standard).Builder(); _userRepository.Add(user); _unitOfWork.Commit(); var result = _userRepository.Get(new Filter()); _userApplicationService.Delete(user.Id); result.totalItems.Should().Be(2); result.entities.Should().HaveCount(2); DomainNotificationHandler.HasNotifications().Should().BeTrue(); DomainNotificationHandler.GetNotifications.First().Value.Should().Be(DomainError.StandardProfileUserDoesNotHavePermission); }
public IActionResult DeleteUser(Guid userId) { var userFound = _userApplication.Get(userId).Data; if (userFound == null) { return(NotFound()); } _userApplication.Delete(userId); return(NoContent()); }
public IActionResult Delete(int id) { _userApplicationService.Delete(id); return(Ok("user was deleted sucessfully")); }
public Task <HttpResponseMessage> Delete(int id) { var user = _service.Delete(id); return(CreateResponse(HttpStatusCode.OK, user)); }
public IActionResult DeleteUser([FromBody] UserDTO userDTO) { _userAppService.Delete(userDTO); return(NoContent()); }
public IActionResult Delete(Guid id) { _userApplicationService.Delete(id); return(Response()); }