예제 #1
0
        public CurrencyTempRoot GetCurrencyRate()
        {
            var           client   = new RestClient(_options.CurrencyApi.ApiHost);
            var           request  = new RestRequest(@_options.CurrencyApi.ApiUrl, Method.GET);
            IRestResponse response = client.Execute(request);

            CurrencyTempRoot currencyRateData = Newtonsoft.Json.JsonConvert.DeserializeObject <CurrencyTempRoot>(response.Content);

            if ((int)response.StatusCode != 200)
            {
                currencyRateData = null;
            }

            return(currencyRateData);
        }
        public CurrencyTempRoot GetCurrencyRate()
        {
            var           client   = new RestClient("https://openexchangerates.org");
            var           request  = new RestRequest(@"/api/latest.json?app_id=c994f29999064bc6aed3f63b32032772", Method.GET);
            IRestResponse response = client.Execute(request);

            CurrencyTempRoot currencyRateData = Newtonsoft.Json.JsonConvert.DeserializeObject <CurrencyTempRoot>(response.Content);

            if ((int)response.StatusCode != 200)
            {
                currencyRateData = null;
            }
            Console.WriteLine("REstApiRun");
            return(currencyRateData);
        }