Beispiel #1
0
        public Response<User> CreateUser(string name, string email, string password, string confirmPassword, Bank objBank, RoleType type, string address)
        {
            var response = new Response<User>();

            if (_repository.Get(email) != null) response.Error = ErrorCode.DuplicateEntity;

            if (password != confirmPassword || password.Length < 6) response.Error = ErrorCode.InvalidState;

            if (response.Success)
            {
                _passwordHandler = new PasswordHandler();
                var user = new User();
                user.Address = address;
                user.BankDetails = objBank;
                user.Email = email;
                user.Name = name;
                user.Role = type;
                user.Password = _passwordHandler.HashPassword(password);
                _repository.Save(user);
                response.Entity = user;
            }

            return response;
        }
Beispiel #2
0
 public UserService()
 {
     _passwordHandler = new PasswordHandler();
     _repository      = new UserRepository();
 }
Beispiel #3
0
 public UserService()
 {
     _passwordHandler = new PasswordHandler();
     _repository = new UserRepository();
 }