public async Task GetProducts()

in Source/ApiGWs/Tailwind.Traders.Bff/Controllers/ProductsController.cs [68:92]


        public async Task<IActionResult> GetProducts([FromQuery] int[] brand = null, [FromQuery] int[] type = null)
        {
            var client = _httpClientFactory.CreateClient(HttpClients.ApiGW);

            var productsUrl = brand.Count() > 0 || type.Count() > 0 ?
                API.Products.GetProductsByFilter(_settings.ProductsApiUrl, VERSION_API, brand, type) :
                API.Products.GetProducts(_settings.ProductsApiUrl, VERSION_API);

            var result = await client.GetStringAsync(productsUrl);
            var products = JsonConvert.DeserializeObject<IEnumerable<Product>>(result);

            result = await client.GetStringAsync(API.Products.GetBrands(_settings.ProductsApiUrl, VERSION_API));
            var brands = JsonConvert.DeserializeObject<IEnumerable<ProductBrand>>(result);

            result = await client.GetStringAsync(API.Products.GetTypes(_settings.ProductsApiUrl, VERSION_API));
            var types = JsonConvert.DeserializeObject<IEnumerable<ProductType>>(result);

            var aggresponse = new
            {
                Products = products,
                Brands = brands,
                Types = types
            };
            return Ok(aggresponse);
        }