public async Task<IdentityResult> UpdateUser(UserModel userModel) { var user = _userManager.FindByName(userModel.UserName); if (user == null) return new IdentityResult("User not found"); if (userModel.Email != null && !user.Email.Equals(userModel.Email)) user.Email = userModel.Email; return await _userManager.UpdateAsync(user); }
public async Task<IdentityResult> RegisterUser(UserModel userModel) { IdentityUser user = new IdentityUser { UserName = userModel.UserName, Email = userModel.Email, }; var result = await _userManager.CreateAsync(user, userModel.Password); return result; }