[ResponseType(typeof (void))] //TODO: return userinfo? public async Task<IHttpActionResult> RegisterAsync(UserModel userModel) { if (!ModelState.IsValid) { return BadRequest(ModelState); } var identityResult = await _userRepository.RegisterUserAsync(userModel); var errorResult = GetErrorResult(identityResult); if (errorResult != null) { return errorResult; } return Ok(); }
public async Task<IdentityResult> RegisterUserAsync(UserModel userModel) { var user = new ApplicationUser(userModel.Username); return await _userManager.CreateAsync(user, userModel.Password); }