예제 #1
0
        public ActionResult Post([FromBody] UserDTO user)
        {
            UserDtoValidator validator = new UserDtoValidator();
            ValidationResult result    = validator.Validate(user);

            if (!result.IsValid)
            {
                return(CustomResponse(result.Errors));
            }
            return(CustomResponse(_userService.Create(user)));
        }
        public async Task <ActionResult <ApplicationUserEntity> > UpdateUser(UserDtoModel editedUser)
        {
            ValidationResult validationResult = userDtoValidator.Validate(editedUser);

            if (!validationResult.IsValid)
            {
                return(BadRequest(validationResult.Errors));
            }

            var updatedUser = await userManageService.EditUserAsync(editedUser);

            return(CreatedAtAction("Updated", editedUser));
        }