public override bool ChangePassword(string username, string oldPassword, string newPassword) { var args = new ValidatePasswordEventArgs(username, oldPassword, true); OnValidatingPassword(args); if (args.Cancel) { return(false); } using (var usersContext = new HypnosisEntities()) { var user = GetUser(usersContext, username); if (user == null) { return(false); } else { string Password = GetMd5Hash(newPassword); user.Password = Password; usersContext.SaveChanges(); } } return(true); }
public void AddUser(HypnosisEntities usersContext, UserProfile user) { usersContext.UserProfiles.Add(user); usersContext.SaveChanges(); }