public async Task<IdentityResult> RegisterUser(RegisterUser userModel) { ApplicationUser user = new ApplicationUser { UserName = userModel.UserName, FirstName = userModel.FirstName, LastName = userModel.LastName, PageSize = userModel.PageSize }; //var result = new IdentityResult(); try { var result = await _userManager.CreateAsync(user, userModel.Password); return result; } catch (DbEntityValidationException e) { foreach (var eve in e.EntityValidationErrors) { Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State); foreach (var ve in eve.ValidationErrors) { Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); } } throw; } }
public ClientUser Create(ApplicationUser user) { return new ClientUser() { UserName = user.UserName, FirstName = user.FirstName, LastName = user.LastName, PageSize = user.PageSize, Email = user.Email }; }
public async Task<IdentityResult> CreateAsync(ApplicationUser user) { var result = await _userManager.CreateAsync(user); return result; }