public async Task <IActionResult> CreateUser([FromBody] CreateUserRequest user) { user.Email = user.Email.ToLower(); var validationErrors = await _userValidator.ValidateCreateUserRequest(user); if (validationErrors.Any()) { return(BadRequest(validationErrors)); } var newUser = new User(user); newUser.Password = _cryptographyService.HashAndSaltPassword(newUser.Password); await _usersRepository.CreateUser(newUser); return(Ok()); }