Esempio n. 1
0
        public ProductSearchQueryParams ConvertToProductSearchQueryParams(ProductsRequestDto request)
        {
            var queryParams = _mapper.Map <ProductSearchQueryParams>(request);

            queryParams.Url = _endpointsConfigurationSection.ProductsUrl;

            return(queryParams);
        }
Esempio n. 2
0
        public async Task <ProductsResponseDto> GetProducts(ProductsRequestDto request)
        {
            var searchParams = _productsFactory.ConvertToProductSearchQueryParams(request);
            var products     = await _productSearchQuerySpecification.IsSatisfiedBy(searchParams);

            foreach (var product in products)
            {
                product.AddHtmlTags(request.Highlight);
            }

            return(_productsFactory.MakeGetProductsResponse(products));
        }
        public async Task <IActionResult> Filter([FromQuery] ProductsRequestDto requestDto)
        {
            var response = await _productsService.GetProducts(requestDto);

            return(Ok(response));
        }