Ejemplo n.º 1
0
        public static API_Obj Import()
        {
            String URLString = "https://v6.exchangerate-api.com/v6/af370279909b3852fbc7252f/latest/USD";

            using (var webClient = new System.Net.WebClient())
            {
                var     json    = webClient.DownloadString(URLString);
                API_Obj aPI_Obj = JsonConvert.DeserializeObject <API_Obj>(json);
                return(aPI_Obj);
            }
        }
Ejemplo n.º 2
0
        public List <double> priceInGbp()
        {
            API_Obj api = Rates.Import();

            foreach (var products in _productManager.DeserializeProducts())
            {
                double tempUSD = products.Price;
                double tempGBP = api.conversion_rates.GBP;
                double result  = tempGBP * tempUSD;
                poundPrice.Add(result);
            }
            return(poundPrice);
        }
Ejemplo n.º 3
0
        public static double Import()
        {
            try
            {
                String URLString = "https://v6.exchangerate-api.com/v6/b526c52212bf00652f4f256d/latest/RON";
                using (var webClient = new System.Net.WebClient())
                {
                    var json = webClient.DownloadString(URLString);

                    Test = JsonConvert.DeserializeObject <API_Obj>(json);

                    return(Test.conversion_rates.EUR);
                }
            }
            catch (Exception e)
            {
                return(0);
            }
        }