public static User CommandToDomain(AthenticationUserCommand command, string context) { return(new User { Context = context, UserName = command.Name, Email = command.Email, PasswordHash = command.Password, FullName = command.FullName }); }
public async Task <IActionResult> Register([FromBody] AthenticationUserCommand command) { try { var user = UserAdapter.CommandToDomain(command, command.Context); var result = await _userManager.CreateAsync(user, user.PasswordHash); if (result.Succeeded) { return(Created("GetUser", command)); } return(BadRequest(result.Errors)); } catch (Exception ex) { return(this.StatusCode(StatusCodes.Status500InternalServerError, ex.Message)); } }