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); }
public void UpdateUser(BursifyUser user) { using (IUnitOfWork uow = unitOfWorkFactory.CreateUnitOfWork()) { userRepository.Save(user); uow.Commit(); } }