Ejemplo n.º 1
0
 public UsersController(IGetUsersCommand getUsers, IGetSingleUserCommand getSingleUser, IInsertUserCommand insertUser, IUpdateUserCommand updateUser, IDeleteUserCommand deleteUser)
 {
     _getUsers      = getUsers;
     _getSingleUser = getSingleUser;
     _insertUser    = insertUser;
     _updateUser    = updateUser;
     _deleteUser    = deleteUser;
 }
Ejemplo n.º 2
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;
 }
Ejemplo n.º 3
0
 public UsersController(IGetUserCommand getOneCommand, IGetUsersCommand getCommand, IAddUserCommand addCommand, IDeleteUserCommand deleteCommand, IUpdateUserCommand updateCommand)
 {
     _getOneCommand = getOneCommand;
     _getCommand    = getCommand;
     _addCommand    = addCommand;
     _deleteCommand = deleteCommand;
     _updateCommand = updateCommand;
 }
Ejemplo n.º 4
0
 public UserController(IGetOneUserCommand getOneUser, ICreateUserCommand createUser, IGetUserCommand getUser, IDeleteUserCommand deleteUser, IUpdateUserCommand updateUser)
 {
     _getOneUser = getOneUser;
     _createUser = createUser;
     _getUser    = getUser;
     _deleteUser = deleteUser;
     _updateUser = updateUser;
 }
Ejemplo n.º 5
0
        public IActionResult Put(int id, [FromBody] UpdateUserDto dto, [FromServices] IUpdateUserCommand command)
        {
            dto.Id = id;

            _executor.ExecuteCommand(command, dto);

            return(StatusCode(StatusCodes.Status204NoContent));
        }
Ejemplo n.º 6
0
        public IActionResult Put(int id, [FromBody] UserDTO dto,
                                 [FromServices] IUpdateUserCommand command)
        {
            dto.Id = id;

            _executor.ExecuteCommand(command, dto);

            return(NoContent());
        }
Ejemplo n.º 7
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;
 }
 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;
 }
Ejemplo n.º 9
0
 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;
 }
Ejemplo n.º 10
0
        public async Task <IActionResult> UpdateUser(UpdateUserRequest user, [FromServices] IUpdateUserCommand command)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            try
            {
                UserResponse response = await command.ExecuteAsync(user);

                return(CreatedAtRoute("GetSingleUser", new { userId = response.Id }, response));
            }
            catch (CannotCreateUserExeption exception)
            {
                foreach (var error in exception.Errors)
                {
                    ModelState.AddModelError(exception.Message, error.Description);
                }
                return(BadRequest(ModelState));
            }
        }
Ejemplo n.º 11
0
 public IActionResult Put(int id, [FromBody] UserDto dto, [FromServices] IUpdateUserCommand command)
 {
     dto.Id = id;
     command.Execute(dto);
     return(NoContent());
 }
Ejemplo n.º 12
0
 public EfUpdateUserCommand(CinemaContext context, UpdateUserValidator validator, IUpdateUserCommand updateUser)
 {
     _context    = context;
     _validator  = validator;
     _updateUser = updateUser;
 }
Ejemplo n.º 13
0
 public void Put([FromBody] UserPutDto dto, [FromServices] IUpdateUserCommand command)
 {
     executor.ExecuteCommand(command, dto);
 }
Ejemplo n.º 14
0
 public void Update(IUpdateUserCommand command)
 {
     this.SetDomainValues(command);
 }
Ejemplo n.º 15
0
 public void Put(int id, [FromBody] UserUpdateDto dto, [FromServices] IUpdateUserCommand command)
 {
     executor.ExecuteCommandUpdate(command, dto, id);
 }
Ejemplo n.º 16
0
 public IActionResult Put([FromBody] UserDto dto, [FromServices] IUpdateUserCommand command)
 {
     executor.ExecuteCommand(command, dto);
     return(Ok(new { StatusCode = HttpStatusCode.OK, Message = "User updated" }));
 }
Ejemplo n.º 17
0
 public ActionResult Put(int id, [FromBody] UpdateUserDto dto,
                         [FromServices] IUpdateUserCommand command)
 {
     executor.ExecuteCommand(command, id, dto);
     return(NoContent());
 }
Ejemplo n.º 18
0
        public void Put(int id, [FromBody] RegisterUserDto dto, [FromServices] IUpdateUserCommand command)
        {
            dto.Rid = id;

            executor.ExecuteCommand(command, dto);
        }