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; }
public UserService() { _passwordHandler = new PasswordHandler(); _repository = new UserRepository(); }