コード例 #1
0
        public BursifyUser RegisterUser(string userEmail, string password, string userType)
        {
            BursifyUser user = null;

            using (IUnitOfWork uow = _unitOfWorkFactory.CreateUnitOfWork())
            {
                var existingUser = _userRepository.GetUserByEmail(userEmail);
                if (existingUser != null)
                {
                    return(null);
                }

                var salt = _cryptoService.CreateSalt();



                user = new BursifyUser
                {
                    Email              = userEmail,
                    PasswordHash       = _cryptoService.HashPassword(password, salt),
                    PasswordSalt       = salt,
                    UserType           = userType,
                    AccountStatus      = "Active",
                    RegistrationDate   = DateTime.UtcNow,
                    ProfilePicturePath = "def"
                };

                _userRepository.Save(user);
                uow.Commit();
            }
            return(user);
        }
コード例 #2
0
 public void UpdateUser(BursifyUser user)
 {
     using (IUnitOfWork uow = unitOfWorkFactory.CreateUnitOfWork())
     {
         userRepository.Save(user);
         uow.Commit();
     }
 }