コード例 #1
0
        public ExchangeRateModel GetModel()
        {
            var currenRates = CurrencyRates.getInstance();
            ExchangeRateModel currencies = JsonConvert.DeserializeObject <ExchangeRateModel>(currenRates.GetRates(_exchangeUrl, _exchangeHost));

            return(currencies);
        }
コード例 #2
0
        public void LogCurrencies(ExchangeRateModel currencies)
        {
            string currenciesData = "DateOfChanges: " +
                                    currencies.Time.ToString("dd.MM.yyyy HH:mm:ss") +
                                    "; USD = " + currencies.Rates.USD +
                                    "; RUB = " + currencies.Rates.RUB +
                                    "; JPY = " + currencies.Rates.JPY;

            File.AppendAllText(_filepath, currenciesData + "\n");
        }
コード例 #3
0
ファイル: Playboy.cs プロジェクト: Avocoders/Rates.API
 public async Task PublishRates(IBusControl bus, ExchangeRateModel currencies)
 {
     await bus.Publish <Currencies>(new
     {
         Rates = new List <Currency>
         {
             new Currency {
                 Code = "EUR", Rate = 1
             },
             new Currency {
                 Code = "USD", Rate = currencies.Rates.USD
             },
             new Currency {
                 Code = "RUB", Rate = currencies.Rates.RUB
             },
             new Currency {
                 Code = "JPY", Rate = currencies.Rates.JPY
             }
         }
     });
 }