Ejemplo n.º 1
0
 static void DispatchCommand(ICommandDispatcher commandDispatcher,
                             NewUserRequest newUserRequest)
 {
     commandDispatcher.Dispatch(new UserSession(), new NewUserCommand
                                                       {
                                                           FirstName = newUserRequest.FirstName,
                                                           LastName = newUserRequest.LastName,
                                                           Name = newUserRequest.Name,
                                                           FacebookId = newUserRequest.FacebookId,
                                                           Locale = newUserRequest.Locale,
                                                           Username = newUserRequest.Username                                                                  
                                                       });
 }
Ejemplo n.º 2
0
 static void DispatchCommand(IPasswordEncryptor passwordEncryptor, ICommandDispatcher commandDispatcher,
                             NewUserRequest newUserRequest)
 {
     commandDispatcher.Dispatch(new NewUserCommand
                                    {
                                        Email = newUserRequest.Email,
                                        EncryptedPassword =
                                            passwordEncryptor.Encrypt(
                                                newUserRequest.Password),
                                        AgreementVersion =
                                            newUserRequest.AgreementVersion
                                    });
 }
Ejemplo n.º 3
0
 static void CheckForExistingFacebookUser(IReadOnlyRepository readOnlyRepository, NewUserRequest newUserRequest)
 {
     bool exists = true;
     try
     {
         readOnlyRepository.First<User>(x => x.FacebookId == newUserRequest.FacebookId);
     }
     catch
     {
         exists = false;
     }
     if (exists)
         throw new UserAlreadyExistsException();
 }
Ejemplo n.º 4
0
 static void CheckForExistingUser(IReadOnlyRepository readOnlyRepository, NewUserRequest newUserRequest)
 {
     var exists = true;
     try
     {
         readOnlyRepository.First<User>(x => x.Email == newUserRequest.Email);                
     }
     catch
     {
         exists = false;
     }
     if (exists)
         throw new UserAlreadyExistsException();
 }