Esempio n. 1
0
        public async Task <ActionResult <List <IntListItem> > > ListAllClients(
            [OpenApiIgnore] CoreApiRequest request)
        {
            // TODO: [TESTS] (ClientsController.ListAllClients) Add tests
            var response = new BaseResponse <List <IntListItem> >()
                           .WithResponse(await _clientService.GetAsListItems(request.UserId));

            return(ProcessResponse(response));
        }
        public async Task <ActionResult <bool> > AddProject(
            [FromBody] ProjectDto projectDto,
            [OpenApiIgnore] CoreApiRequest request)
        {
            // TODO: [TESTS] (ProjectsController.AddProject) Add tests
            var response = new BaseResponse <bool>()
                           .WithValidation(ProjectDtoValidator.Add(projectDto));

            if (response.PassedValidation)
            {
                response.WithResponse(await _projectService.AddProject(request.UserId, projectDto));
            }

            return(ProcessResponse(response));
        }
Esempio n. 3
0
        public async Task <ActionResult <bool> > UpdateClient(
            [FromBody] ClientDto clientDto,
            [OpenApiIgnore] CoreApiRequest request)
        {
            // TODO: [TESTS] (ClientsController.UpdateClient) Add tests
            var response = new BaseResponse <bool>()
                           .WithValidation(ClientDtoValidator.Update(clientDto));

            if (response.PassedValidation)
            {
                response.WithResponse(await _clientService.Update(request.UserId, clientDto));
            }

            return(ProcessResponse(response));
        }
        public async Task <ActionResult <List <ProjectDto> > > GetProductProjects(
            [FromRoute] int productId,
            [OpenApiIgnore] CoreApiRequest request)
        {
            // TODO: [TESTS] (ProjectsController.GetProductProjects) Add tests
            var response = new BaseResponse <List <ProjectDto> >()
                           .WithValidation(new AdHockValidator()
                                           .GreaterThanZero(nameof(productId), productId)
                                           );

            if (response.PassedValidation)
            {
                response.WithResponse(await _projectService.GetAllForProduct(request.UserId, productId));
            }

            return(ProcessResponse(response));
        }
Esempio n. 5
0
        public async Task <ActionResult <ClientDto> > GetClientById(
            [FromRoute] int clientId,
            [OpenApiIgnore] CoreApiRequest request)
        {
            // TODO: [TESTS] (ClientsController.GetClientById) Add tests
            var response = new BaseResponse <ClientDto>()
                           .WithValidation(new AdHockValidator().GreaterThanZero(nameof(clientId), clientId));

            if (response.PassedValidation)
            {
                response.WithResponse(await _clientService.GetById(
                                          request.UserId,
                                          clientId
                                          ));
            }

            return(ProcessResponse(response));
        }
Esempio n. 6
0
        public async Task <ActionResult <List <IntListItem> > > ListClientProducts(
            [FromRoute] int clientId,
            [OpenApiIgnore] CoreApiRequest request)
        {
            // TODO: [TESTS] (ProductsController.ListClientProducts) Add tests
            var response = new BaseResponse <List <IntListItem> >()
                           .WithValidation(new AdHockValidator()
                                           .GreaterThanZero(nameof(clientId), clientId)
                                           );

            if (response.PassedValidation)
            {
                response.WithResponse(await _productService.GetClientProductsListItems(
                                          request.UserId,
                                          clientId
                                          ));
            }

            return(ProcessResponse(response));
        }