public ExchangeRateModel GetModel() { var currenRates = CurrencyRates.getInstance(); ExchangeRateModel currencies = JsonConvert.DeserializeObject <ExchangeRateModel>(currenRates.GetRates(_exchangeUrl, _exchangeHost)); return(currencies); }
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"); }
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 } } }); }