コード例 #1
0
 public Money GetValueInCurrency(Money money, string targetCurrency)
 {
     return(new Money(
                _exchangeRateRepository.GetExchangeRate(money.Currency, targetCurrency) * money.Value,
                targetCurrency));
 }
コード例 #2
0
 public IActionResult Index(int?currencyInId, int?currencyOutId)
 {
     TempData["InId"]  = currencyInId;
     TempData["OutId"] = currencyOutId;
     return(View(_repository.GetExchangeRate(currencyInId, currencyOutId)));
 }
コード例 #3
0
        public decimal Exchange(string fromCurrency, string toCurrency, decimal value)
        {
            var rate = _exchangeRateRepository.GetExchangeRate(fromCurrency, toCurrency).Result;

            return(value * rate);
        }