예제 #1
0
 public void Save(User user)
 {
     if (user.ID != Guid.Empty)
     {
         _userRepository.Update(user);
     }
     else
     {
         _userRepository.Create(user);
     }
 }
예제 #2
0
 public void AddNewUser(User user)
 {
     _userRepository.Create(user);
 }
예제 #3
0
 public void EditUser(User user)
 {
     _userRepository.Update(user);
 }
        public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status)
        {
            var args = new ValidatePasswordEventArgs(username, password, true);
            OnValidatingPassword(args);

            if (args.Cancel)
            {
                status = MembershipCreateStatus.InvalidPassword;
                return null;
            }

            if (RequiresUniqueEmail && GetUserNameByEmail(email) != string.Empty)
            {
                status = MembershipCreateStatus.DuplicateEmail;
                return null;
            }

            var user = GetUser(username, true);

            if (user == null)
            {
                //var userObj = new User { UserName = username, Password = GetMd5Hash(password), UserEmailAddress = email };

                //pswdService = new PasswordService(password);

                var newUser = new User { Login = username, Password = GetMd5Hash(password)/*pswdService.Hash, PasswordSalt = pswdService.Salt*/, Email = email };

                /*using (var usersContext = new UsersContext())
                {
                    usersContext.AddUser(userObj);
                }*/

                _userService.AddNewUser(newUser);

                status = MembershipCreateStatus.Success;

                return GetUser(username, true);
            }
            status = MembershipCreateStatus.DuplicateUserName;

            return null;
        }