public bool Insert(RegisterModel model, IValidationDictionary validation) { ValidateNewUser(model, validation); if (validation.IsValid) { var salt = GenerateSalt(20); var user = new User { UserName = model.UserName, PasswordSalt = salt, Password = HashPassword(model.Password, salt), Email = model.Email, DisplayName = model.DisplayName }; _context.Users.Add(user); return true; } return false; }
public void Update(User user) { _context.Entry(user).State = EntityState.Modified; }