public async Task<IdentityResult> RegisterUser(UserModel userModel) { ApplicationUser user = new ApplicationUser { UserName = userModel.UserName, TeamId = userModel.TeamId }; var result = await _userManager.CreateAsync(user, userModel.Password); return result; }
public async Task<IHttpActionResult> Register(UserModel userModel) { if (!ModelState.IsValid) { return BadRequest(ModelState); } IdentityResult result = await _repo.RegisterUser(userModel); IHttpActionResult errorResult = GetErrorResult(result); if (errorResult != null) { return errorResult; } return Ok(); }
public async Task<IHttpActionResult> AddTeamManager(UserModel userModel) { if(IsAdmin()) { var password = userModel.UserName.Substring(0, userModel.UserName.IndexOf("@")); password = password + "@123456"; userModel.Password = password; userModel.ConfirmPassword = password; IdentityResult result = await _repo.RegisterUser(userModel); IHttpActionResult errorResult = GetErrorResult(result); if (errorResult != null) { return errorResult; } } return Ok(); }