Exemple #1
0
 public UserInfoDTO RegisterUser(UserRegisterDTO userRegister)
 {
     try
     {
         if (UserDBContext.UserEmailExists(userRegister.Email))
         {
             throw new EmailAlreadyExistsException("Email already exists");
         }
         userRegister.HashPassword = PasswordHasher.HashPassword(userRegister.Password);
         UserInfoDTO newUserInfoDTO = UserDBContext.AddUser(userRegister);
         return(newUserInfoDTO);
     }
     catch (EmailAlreadyExistsException ex)
     {
         throw new EmailAlreadyExistsException();
     }
     catch (Exception ex) { throw new Exception(); }
 }