// TODO: Error handling and check that password and the confirmation password // entries are the same. public async Task<IdentityResult> RegisterUser(RegisterUserViewModel model) { User user = new User { UserName = model.UserName, Email = model.Email, Name = model.FirstName + " " + model.LastName }; var result = await UserManager.CreateAsync(user, model.Password); return result; }
public async Task<IHttpActionResult> Register(RegisterUserViewModel model) { if (!ModelState.IsValid) { return BadRequest(ModelState); } IdentityResult result = await _repo.RegisterUser(model); IHttpActionResult errorResult = GetErrorResult(result); if (errorResult != null) { return errorResult; } return Ok(); }