public async Task <ActionResult> Register([FromForm] RegisterRequest registerRequest) { var account = registerRequest.Adapt <Account>(); await accountService.Register(account); return(StatusCode((int)HttpStatusCode.Created)); }
public async Task <string> RegisterAsync(RegisterRequest registerRequest) { var user = registerRequest.Adapt <RegisterRequest, User>(); var fileName = await _photoService.CreateDefaultAvatarAsync(user.FirstName, user.LastName); user.Id = Guid.NewGuid(); user.Avatar = new Photo { Id = Guid.NewGuid(), FileName = fileName }; var registerResult = await _userManager.CreateAsync(user, registerRequest.Password); if (registerResult.Succeeded) { return(GetUserToken(user)); } return(string.Empty); }