public async Task <IActionResult> ChangeProfile([FromBody] ChangeProfile.InModel inModel) { ChangeProfileValidator validationRules = new ChangeProfileValidator(); await validationRules.ValidateAndThrowAsync(inModel); await _userService.UpdateProfile(inModel.UserId, inModel.Email, inModel.Username); return(Ok()); }
public IActionResult ChangeProfile([FromBody] ChangeProfileDto dto , [FromServices] IChangeProfileCommand command , [FromServices] ChangeProfileValidator validator) { dto.Id = _actor.Id; var result = validator.Validate(dto); if (result.IsValid) { ApplicationUser applicationUser = _mapper.Map <ApplicationUser>(dto); _executor.ExecuteCommand(command, applicationUser); return(Ok("Application user changed successfully")); } return(UnprocessableEntity(UnprocessableEntityResponse.Message(result.Errors))); }