Ejemplo n.º 1
0
        public Task <IListDto <ProductDto> > GetAllProductAsync(ProductRequestAllDto request)
        {
            IListDto <ProductDto> result = new ListDto <ProductDto> {
                HasNext = false, Items = list
            };

            return(result.AsTask());
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> GetAll([FromQuery] ProductRequestAllDto requestAll)
        {
            if (requestAll == null)
            {
                return(BadRequest(ListDto <ProductDto> .Empty()));
            }

            var response = await _productDomainService.GetAllAsync <ProductDto>(requestAll,
                                                                                (p) => requestAll.Description.IsNullOrEmpty() || p.Description.Contains(requestAll.Description));

            return(CreateResponseOnGetAll(response, name));
        }
Ejemplo n.º 3
0
        // Exemplo de operação de update parcial explícito (valor resetado para mínimo)
        public async Task <IListDto <ProductDto> > ResetAllProductAsync(ProductRequestAllDto request)
        {
            var products = await _readRepository.GetAllProductsAsync(request);

            foreach (var productDto in products.Items)
            {
                productDto.Value = 1;

                var product = Product.Create(Notification)
                              .WithId(productDto.Id)
                              .WithDescription(productDto.Description)
                              .WithValue(1)
                              .Build();

                await _repository.UpdateProductAsync(product, p => p.Value);
            }

            return(products);
        }
Ejemplo n.º 4
0
 public Task <IListDto <ProductDto> > ResetAllProductAsync(ProductRequestAllDto request)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 5
0
 public async Task <IListDto <ProductDto> > GetAllProductsAsync(ProductRequestAllDto key)
 => await GetAllAsync <ProductDto>(key, p => key.Description.IsNullOrEmpty() || p.Description.Contains(key.Description));
Ejemplo n.º 6
0
 public async Task <IListDto <ProductResponseDto> > GetAllProductAsync(ProductRequestAllDto request)
 => await _readRepository.GetAllProductsAsync(request);
        public async Task <IActionResult> GetAll([FromQuery] ProductRequestAllDto requestDto)
        {
            var response = await _appService.GetAllAsync(requestDto);

            return(CreateResponseOnGetAll(response, _name));
        }
Ejemplo n.º 8
0
 public Task <IListDto <ProductDto> > GetAllProductsAsync(ProductRequestAllDto key)
 => list.ToListDto <Product, ProductDto>(false).AsTask();
Ejemplo n.º 9
0
 public async Task <IListDto <ProductDto, Guid> > GetAllProductAsync(ProductRequestAllDto request)
 => await readRepository.GetAllProductsAsync(request);
Ejemplo n.º 10
0
        public async Task <IActionResult> ResetValue([FromQuery] ProductRequestAllDto requestDto)
        {
            var products = await _appService.ResetAllProductAsync(requestDto);

            return(CreateResponseOnPut(products, _name));
        }
 public async Task <IListDto <ProductDto> > GetAllAsync(ProductRequestAllDto request)
 => await _service.GetAllAsync <ProductDto>(request
                                            , p => request.Description.IsNullOrEmpty() || p.Description.Contains(request.Description));