コード例 #1
0
        public void Trigger(CreatorCommand command)
        {
            var username = new AuthUsername(command.GetUsername());
            var password = new AuthPassword(command.GetPassword());

            Creator.Create(username, password, command.GetFirstName(), command.GetLastName());
        }
コード例 #2
0
ファイル: UserFactory.cs プロジェクト: JoseMarkos/AltoValyrio
        public void Create(int role, CreatorCommand command)
        {
            SQLServerUsersRepository usersRepository      = new SQLServerUsersRepository();
            AdministratorCreator     administratorCreator = new AdministratorCreator(usersRepository);
            CustomerCreator          customerCreator      = new CustomerCreator(usersRepository);
            CreatorCommandHandler    administratorHandler = new CreatorCommandHandler(administratorCreator);
            CreatorCommandHandler    customerHandler      = new CreatorCommandHandler(customerCreator);


            switch (role)
            {
            case (int)Roles.Administrator:
                administratorHandler.Trigger(command);
                break;

            case (int)Roles.Customer:
                customerHandler.Trigger(command);
                break;

            default:
                throw new InvalidUserRoleException();
            }
        }