Example #1
0
        public void RefreshRates()
        {
            WebRequest request = HttpWebRequest.Create("https://api.exchangeratesapi.io/latest?base=TRY");

            WebResponse  response = request.GetResponse();
            StreamReader reader   = new StreamReader(response.GetResponseStream());

            string ExRates_JSON = reader.ReadToEnd();

            MyExRates = Newtonsoft.Json.JsonConvert.DeserializeObject <ExRates>(ExRates_JSON);
        }
Example #2
0
        public void GetRates(DateTime dt)
        {
            String dateString = dt.ToString("yyyy-MM-dd");

            WebRequest request = HttpWebRequest.Create("https://api.exchangeratesapi.io/" + dateString + "?base=TRY");

            WebResponse  response = request.GetResponse();
            StreamReader reader   = new StreamReader(response.GetResponseStream());

            string ExRates_JSON = reader.ReadToEnd();

            MyExRates = Newtonsoft.Json.JsonConvert.DeserializeObject <ExRates>(ExRates_JSON);
        }