コード例 #1
0
        public async Task <IActionResult> Index()
        {
            var deserializedEUR = new Root();
            var deserializedUSD = new Root();

            deserializedEUR = await EService.GetExchange("eur");

            deserializedUSD = await EService.GetExchange("usd");

            var model = new ExchangeModel
            {
                effectiveDateUSD  = deserializedUSD.rates[0].effectiveDate,
                midUSD            = deserializedUSD.rates[0].mid,
                effectiveDateUSD1 = deserializedUSD.rates[1].effectiveDate,
                midUSD1           = deserializedUSD.rates[1].mid,
                changeUSD         = EService.GetChange(deserializedUSD.rates[0].mid, deserializedUSD.rates[1].mid),

                effectiveDateEUR  = deserializedUSD.rates[0].effectiveDate,
                midEUR            = deserializedEUR.rates[0].mid,
                effectiveDateEUR1 = deserializedUSD.rates[1].effectiveDate,
                midEUR1           = deserializedEUR.rates[1].mid,
                changeEUR         = EService.GetChange(deserializedEUR.rates[0].mid, deserializedEUR.rates[1].mid),
            };

            return(View(model));
        }
コード例 #2
0
 public Decimal GetExchange(DateTime dateTime, string FromCurrencyCode, string ToCurrencyCode)
 {
     return(dal.GetExchange(dateTime, FromCurrencyCode, ToCurrencyCode));
 }