예제 #1
0
 public decimal GetExchangeRate(CurrencyPair currencyPair)
 {
     if (currencyPair.HaveSameCurrency())
     {
         return(1);
     }
     return(_exchangeRateProvider.GetExchangeRate(currencyPair.FromCurrency, currencyPair.ToCurrency));
 }
예제 #2
0
        public decimal Convert(decimal amount, CurrencyPair currencyPair)
        {
            if (currencyPair.HaveSameCurrency())
            {
                return(amount);
            }

            if (amount != 0)
            {
                var exchangeRate = GetExchangeRate(currencyPair);
                return(amount * exchangeRate);
            }

            return(amount);
        }