コード例 #1
0
        public UserModule(IUserRepository userRepo, ICreateUserCommand createUserCommand, IUpdateUserPasswordCommand updateUserPasswordCommand, IDeleteUserCommand deleteUserCommand) : base()
        {
            _userRepo                  = userRepo;
            _createUserCommand         = createUserCommand;
            _updateUserPasswordCommand = updateUserPasswordCommand;
            _deleteUserCommand         = deleteUserCommand;

            Get[Actions.User.Default] = (x) =>
            {
                AddScript(Scripts.UserView);
                return(Default());
            };
            Post[Actions.User.Delete] = (x) =>
            {
                this.RequiresClaims(new[] { Claims.UserDelete });
                return(DeleteUser());
            };
            Get[Actions.User.List] = (x) =>
            {
                this.RequiresClaims(new[] { Claims.UserList });
                return(List());
            };
            Post[Actions.User.ChangePassword] = (x) =>
            {
                return(ChangePassword());
            };
            Post[Actions.User.Save] = (x) =>
            {
                this.RequiresClaims(new[] { Claims.UserAdd });
                return(Save());
            };
        }
コード例 #2
0
 public UserController(IAddUserCommand addUserCommand, IEditUserCommand editUserCommand, IDeleteUserCommand deleteUserCommand, IGetAllUsersQuery getAllUsersQuery)
 {
     _addUserCommand = addUserCommand;
     _editUserCommand = editUserCommand;
     _deleteUserCommand = deleteUserCommand;
     _getAllUsersQuery = getAllUsersQuery;
 }
コード例 #3
0
 public UsersController(IGetUsersCommand getUsers, IGetSingleUserCommand getSingleUser, IInsertUserCommand insertUser, IUpdateUserCommand updateUser, IDeleteUserCommand deleteUser)
 {
     _getUsers      = getUsers;
     _getSingleUser = getSingleUser;
     _insertUser    = insertUser;
     _updateUser    = updateUser;
     _deleteUser    = deleteUser;
 }
コード例 #4
0
 public UsersController(ICreateUserCommand createUser, IGetUsersCommand getUsers, IEditUserCommand editUser, IDeleteUserCommand deleteUser, Context baza)
 {
     this.createUser = createUser;
     this.getUsers   = getUsers;
     this.editUser   = editUser;
     this.deleteUser = deleteUser;
     this.baza       = baza;
 }
コード例 #5
0
 public DeleteOrganizationCommand(IDatabaseProvider connection, 
     IDeleteUserCommand deleteUserCommand, 
     IGetUsersByOrganizationQuery getUsersByOrganizationQuery)
 {
     _connection = connection;
     _deleteUserCommand = deleteUserCommand;
     _getUsersByOrganizationQuery = getUsersByOrganizationQuery;
 }
コード例 #6
0
 public UsersController(IGetUsersCommand getUsers, IGetUserCommand getUser, IAddUserCommand addUser, IEditUserCommand editUser, IDeleteUserCommand deleteUser)
 {
     _getUsers   = getUsers;
     _getUser    = getUser;
     _addUser    = addUser;
     _editUser   = editUser;
     _deleteUser = deleteUser;
 }
コード例 #7
0
 public void Setup()
 {
     _mockedAddUserCommand = MockRepository.GenerateMock<IAddUserCommand>();
     _mockedEditUserCommand = MockRepository.GenerateMock<IEditUserCommand>();
     _mockedDeleteUserCommand = MockRepository.GenerateMock<IDeleteUserCommand>();
     _mockedGetAllUsersQuery = MockRepository.GenerateMock<IGetAllUsersQuery>();
     _controller = new UserController(_mockedAddUserCommand, _mockedEditUserCommand, _mockedDeleteUserCommand, _mockedGetAllUsersQuery);
 }
コード例 #8
0
ファイル: UserController.cs プロジェクト: ika43/dataset-movie
 public UserController(IGetOneUserCommand getOneUser, ICreateUserCommand createUser, IGetUserCommand getUser, IDeleteUserCommand deleteUser, IUpdateUserCommand updateUser)
 {
     _getOneUser = getOneUser;
     _createUser = createUser;
     _getUser    = getUser;
     _deleteUser = deleteUser;
     _updateUser = updateUser;
 }
コード例 #9
0
 public UsersController(IGetUserCommand getOneCommand, IGetUsersCommand getCommand, IAddUserCommand addCommand, IDeleteUserCommand deleteCommand, IUpdateUserCommand updateCommand)
 {
     _getOneCommand = getOneCommand;
     _getCommand    = getCommand;
     _addCommand    = addCommand;
     _deleteCommand = deleteCommand;
     _updateCommand = updateCommand;
 }
コード例 #10
0
 public UsersController(IDeleteUserCommand deleteUserCommand, IGetUserCommand getUserCommand, IGetUsersCommand getUsersCommand, IInsertUserCommand insertUserCommand, IUpdateUserCommand updateUserCommand)
 {
     this.deleteUserCommand = deleteUserCommand;
     this.getUserCommand    = getUserCommand;
     this.getUsersCommand   = getUsersCommand;
     this.insertUserCommand = insertUserCommand;
     this.updateUserCommand = updateUserCommand;
 }
コード例 #11
0
 public UserController(IGetUsersCommand getCommand, IGetUserCommand getOneCommand, ICreateUserCommand createUserCommand, IEditUserCommand editUserCommand, IDeleteUserCommand deleteUserCommand)
 {
     _getCommand        = getCommand;
     _getOneCommand     = getOneCommand;
     _createUserCommand = createUserCommand;
     _editUserCommand   = editUserCommand;
     _deleteUserCommand = deleteUserCommand;
 }
コード例 #12
0
 public UsersController(ICreateUserCommand userCreate, IEditUserCommand userEdit, IGetUserCommand userGet, IGetUsersPaginatedCommand usersGet, IDeleteUserCommand deleteUser)
 {
     _userCreate = userCreate;
     _userEdit   = userEdit;
     _userGet    = userGet;
     _usersGet   = usersGet;
     _deleteUser = deleteUser;
 }
コード例 #13
0
 public UserController(IGetUsersCommand getUsersCommand, IAddUserCommand addUserCommand, IGetUserCommand getUserCommand, IDeleteUserCommand deleteUsersCommand, IEditUserCommand editUserCommand)
 {
     _getUsersCommand    = getUsersCommand;
     _addUserCommand     = addUserCommand;
     _getUserCommand     = getUserCommand;
     _deleteUsersCommand = deleteUsersCommand;
     _editUserCommand    = editUserCommand;
 }
コード例 #14
0
 public UserController(IAddUserCommand createUser, IGetUsersQuery getUser, IEditUserCommand editUser, IDeleteUserCommand deleteUser, ProjekatContext context)
 {
     this.createUser = createUser;
     this.getUser    = getUser;
     this.editUser   = editUser;
     this.deleteUser = deleteUser;
     this.context    = context;
 }
コード例 #15
0
 public UsersController(IGetUsersCommand getUsers, IGetUserCommand getUser, IAddUserCommand addUser, IEditUserCommand editUser, IDeleteUserCommand deleteUser)
 {
     this.getUsers   = getUsers;
     this.getUser    = getUser;
     this.addUser    = addUser;
     this.editUser   = editUser;
     this.deleteUser = deleteUser;
 }
コード例 #16
0
 public UsersController(IGetUserCommand getUser, IGetUsersCommand getUsers, ICreateUserCommand createUser, IEditUserCommand editUser, IDeleteUserCommand deleteUser)
 {
     _getUser    = getUser;
     _getUsers   = getUsers;
     _createUser = createUser;
     _editUser   = editUser;
     _deleteUser = deleteUser;
 }
コード例 #17
0
 public UserController(IGetUserCommand getUserCommand, IGetUsersCommand getUsersCommand, IEditUserCommand editUserCommand, IAddUserCommand addUserCommand, IDeleteUserCommand deleteUserCommand, LoggedUser loggedUser)
 {
     _getUsersCommand   = getUsersCommand;
     _getUserCommand    = getUserCommand;
     _editUserCommand   = editUserCommand;
     _addUserCommand    = addUserCommand;
     _deleteUserCommand = deleteUserCommand;
     _loggedUser        = loggedUser;
 }
コード例 #18
0
 public UsersController(IGetUsersCommand searchUsersCommand, IGetUserCommand getOneUserCommand, ICreateUserCommand createUserCommand, IEditUserCommand editUserCommand, IDeleteUserCommand deleteUserCommand, WebNewsContext context)
 {
     _searchUsersCommand = searchUsersCommand;
     _getOneUserCommand  = getOneUserCommand;
     _createUserCommand  = createUserCommand;
     _editUserCommand    = editUserCommand;
     _deleteUserCommand  = deleteUserCommand;
     _context            = context;
 }
コード例 #19
0
 public UsersController(Context context, IGetUsersCommand getCommand, IGetUserCommand getOneCommand, IAddUserCommand addUserCommand, IEditUserCommand editUserCommand, IDeleteUserCommand deleteUserCommand)
 {
     _context           = context;
     _getCommand        = getCommand;
     _getOneCommand     = getOneCommand;
     _addUserCommand    = addUserCommand;
     _editUserCommand   = editUserCommand;
     _deleteUserCommand = deleteUserCommand;
 }
コード例 #20
0
 public UserController(IGetUsersCommand getUsersCommand, IGetUserCommand getUserCommand, IAddNewUserCommand addUserCommand, IDeleteUserCommand deleteUserCommand, IEmailSender emailSender, IEditUserCommand editUserCommand)
 {
     _getUsersCommand   = getUsersCommand;
     _getUserCommand    = getUserCommand;
     _addUserCommand    = addUserCommand;
     _deleteUserCommand = deleteUserCommand;
     _emailSender       = emailSender;
     _editUserCommand   = editUserCommand;
 }
コード例 #21
0
 public UserController(IAddUserCommand addUserCommand, IDeleteUserCommand deleteUserCommand, IGetUserCommand getUserCommand, IEditUserCommand editUserCommand, IGetUsersCommand getUsersCommand, IEmailSender sender)
 {
     _addUserCommand    = addUserCommand;
     _deleteUserCommand = deleteUserCommand;
     _getUserCommand    = getUserCommand;
     _editUserCommand   = editUserCommand;
     _getUsersCommand   = getUsersCommand;
     _sender            = sender;
 }
コード例 #22
0
 public UsersController(ICreateUserCommand createUser, IActivateUserCommand activateUser, IGetUsersCommand getUsers, IDeleteUserCommand deleteUser, IEditUserEmailCommand editUserEmail, IEditUserPasswordCommand editUserPassword, IAuthenticateUserCommand authUser)
 {
     _createUser       = createUser;
     _activateUser     = activateUser;
     _getUsers         = getUsers;
     _deleteUser       = deleteUser;
     _editUserEmail    = editUserEmail;
     _editUserPassword = editUserPassword;
     _authUser         = authUser;
 }
コード例 #23
0
 public UsersController(IGetUsersCommand getUsers, IGetUserCommand getUser, IAddUserCommand addUser, IGetRolesCommand getRoles, IEditUserCommand editUser, IDeleteUserCommand deleteUser, UseCaseExecutor executor, IAddUserCasesCommand addUserCases)
 {
     this.getUsers     = getUsers;
     this.getUser      = getUser;
     this.addUser      = addUser;
     this.getRoles     = getRoles;
     this.editUser     = editUser;
     this.deleteUser   = deleteUser;
     this.executor     = executor;
     this.addUserCases = addUserCases;
 }
コード例 #24
0
 public IActionResult Delete(int id, [FromServices] IDeleteUserCommand command)
 {
     try
     {
         executor.ExecuteCommand(command, id);
         return(StatusCode(204, "User deleted"));
     }
     catch
     {
         return(StatusCode(422, "Fail"));
     }
 }
コード例 #25
0
 public IActionResult Delete(int id, [FromServices] IDeleteUserCommand command)
 {
     try
     {
         executor.ExecuteCommand(command, id);
         return(NoContent());
     }
     catch (EntityNotFoundException ex)
     {
         return(NotFound());
     }
 }
コード例 #26
0
 public UsersController(IAddUserCommand _addUserCommand,
                        IGetUserCommand _getUserCommand,
                        IGetUsersCommand _getUsersCommand,
                        IEditUserCommand _editUserCommand,
                        IDeleteUserCommand _deleteUserCommand)
 {
     this._addUserCommand    = _addUserCommand;
     this._getUserCommand    = _getUserCommand;
     this._getUsersCommand   = _getUsersCommand;
     this._editUserCommand   = _editUserCommand;
     this._deleteUserCommand = _deleteUserCommand;
 }
コード例 #27
0
        public async Task <IActionResult> DeleteUserAsync(Guid userId, [FromServices] IDeleteUserCommand command)
        {
            try
            {
                await command.ExecuteAsync(userId);

                return(NoContent());
            }
            catch (Exception exception)
            {
                return(BadRequest(exception.Message));
            }
        }
コード例 #28
0
 public UsersController(IAddUserCommand addUserCommand,
                        IDeleteUserCommand deleteUserCommand,
                        IUpdateUserCommand updateUserCommand,
                        IGetUserByIdValueQuery getUserByIdValueQuery,
                        IGetAllUsersQuery getAllUsersQuery,
                        IGetAllUsersPaginatedQuery getAllUsersPaginatedQuery)
 {
     _addUserCommand            = addUserCommand;
     _deleteUserCommand         = deleteUserCommand;
     _updateUserCommand         = updateUserCommand;
     _getUserByIdValueQuery     = getUserByIdValueQuery;
     _getAllUsersQuery          = getAllUsersQuery;
     _getAllUsersPaginatedQuery = getAllUsersPaginatedQuery;
 }
コード例 #29
0
        public void UserModuleTest_SetUp()
        {
            _userRepo                  = Substitute.For <IUserRepository>();
            _userValidator             = Substitute.For <IUserValidator>();
            _passwordProvider          = Substitute.For <IPasswordProvider>();
            _createUserCommand         = Substitute.For <ICreateUserCommand>();
            _updateUserPasswordCommand = Substitute.For <IUpdateUserPasswordCommand>();
            _deleteUserCommand         = Substitute.For <IDeleteUserCommand>();

            Mapper.Initialize((cfg) =>
            {
                cfg.CreateMap <UserViewModel, UserModel>();
            });
        }
コード例 #30
0
 public UsersController(IGetUserCommand getUser,
                        IGetUsersCommand getUsers,
                        IAddUserCommand addUser,
                        IEditUserCommand editUser,
                        IDeleteUserCommand deleteUser,
                        IGetRolesWithoutPaginationCommand getRoles)
 {
     _getUser    = getUser;
     _getUsers   = getUsers;
     _addUser    = addUser;
     _editUser   = editUser;
     _deleteUser = deleteUser;
     _getRoles   = getRoles;
 }
コード例 #31
0
ファイル: UserService.cs プロジェクト: mattapayne/ColorSoft
 public UserService(IDeleteUserCommand deleteUserCommand,
                    IUpdateUserCommand updateUserCommand,
                    ICreateUserCommand createUserCommand,
                    IGetUserByIdQuery getUserByIdQuery,
                    IGetAllNonDeletedUsersQuery getAllNonDeletedUsersQuery,
                    IGetUserByUsernameQuery getUserByUsernameQuery, 
                    IGetUserByEmailQuery getUserByEmailQuery)
 {
     _deleteUserCommand = deleteUserCommand;
     _updateUserCommand = updateUserCommand;
     _createUserCommand = createUserCommand;
     _getUserByIdQuery = getUserByIdQuery;
     _getAllNonDeletedUsersQuery = getAllNonDeletedUsersQuery;
     _getUserByUsernameQuery = getUserByUsernameQuery;
     _getUserByEmailQuery = getUserByEmailQuery;
 }
コード例 #32
0
 public UsersController(
     ILogger <UsersController> logger,
     ICreateUserCommand createUserCommand,
     IUpdateUserCommand updateUserCommand,
     IDeleteUserCommand deleteUserCommand,
     IGetUserQuery getUserQuery,
     IGetAllUsersQuery getAllUsersQuery
     )
 {
     this.logger            = logger;
     this.createUserCommand = createUserCommand;
     this.updateUserCommand = updateUserCommand;
     this.deleteUserCommand = deleteUserCommand;
     this.getUserQuery      = getUserQuery;
     this.getAllUsersQuery  = getAllUsersQuery;
 }
コード例 #33
0
 public UsersController(IAddUserCommand addUserCommand,
                        IEditUserCommand editUserCommand,
                        IDeleteUserCommand deleteUserCommand,
                        IPagingViewModelGenerator pagingViewModelGenerator,
                        IGetUserQuery getUserQuery,
                        ISendNotificationCommand sendNotificationCommand,
                        IEncryptor encryptor,
                        IAuthenticationManager authenticationManager)
 {
     _addUserCommand           = addUserCommand;
     _editUserCommand          = editUserCommand;
     _deleteUserCommand        = deleteUserCommand;
     _pagingViewModelGenerator = pagingViewModelGenerator;
     _getUserQuery             = getUserQuery;
     _sendNotificationCommand  = sendNotificationCommand;
     _encryptor             = encryptor;
     _authenticationManager = authenticationManager;
 }
コード例 #34
0
 public IActionResult Delete(int id, [FromServices] IDeleteUserCommand command)
 {
     executor.ExecuteCommand(command, id);
     return(StatusCode(StatusCodes.Status204NoContent));
 }
コード例 #35
0
 public void Setup()
 {
     _userByEmailQuery = Substitute.For<IUserByEmailQuery>();
     _createUserCommand = Substitute.For<ICreateUserCommand>();
     _deleteUserCommand = Substitute.For<IDeleteUserCommand>();
 }