Exemple #1
0
        public async Task <IActionResult> GetAllProducts([FromQuery] string requestedCurrency, string requestedProduct)
        {
            var            parser = new DataParser();
            ConverterLogic logic  = new ConverterLogic();

            string currencyData = await parser.GetFile(RateUrl, client);

            string productData = await parser.GetFile(ProductUrl, client);

            List <CurrencyRate> RateList    = logic.CurrencyRateToList(currencyData, ',', 1);
            List <Product>      ProductList = logic.ProductsToList(productData, ',', 1);

            Result price = logic.ConvertCurrency(RateList, ProductList, requestedCurrency, requestedProduct);

            var output = JsonConvert.SerializeObject(price);

            return(Ok(output));
        }