private CurrencyRates GetGBPConversionRate(EnumCurrencyList dest, double gbpVsEUR, Rates rates) { double gbpRate = 1 / gbpVsEUR; switch (dest) { case EnumCurrencyList.AUD: return(new CurrencyRates() { BaseCurrency = EnumCurrencyList.GBP, TargetCurrency = EnumCurrencyList.AUD, ConversionRate = (gbpRate * rates.AUD), Timestamp = DateTime.Now }); case EnumCurrencyList.SEK: return(new CurrencyRates() { BaseCurrency = EnumCurrencyList.GBP, TargetCurrency = EnumCurrencyList.SEK, ConversionRate = (gbpRate * rates.USD), Timestamp = DateTime.Now }); case EnumCurrencyList.USD: return(new CurrencyRates() { BaseCurrency = EnumCurrencyList.GBP, TargetCurrency = EnumCurrencyList.USD, ConversionRate = (gbpRate * rates.USD), Timestamp = DateTime.Now }); case EnumCurrencyList.EUR: return(new CurrencyRates() { BaseCurrency = EnumCurrencyList.GBP, TargetCurrency = EnumCurrencyList.EUR, ConversionRate = gbpRate, Timestamp = DateTime.Now }); } return(null); }
private CurrencyRates GetUSDConversionRate(EnumCurrencyList dest, double rate, Rates rates) { double usdRate = 1 / rate; switch (dest) { case EnumCurrencyList.AUD: return(new CurrencyRates() { BaseCurrency = EnumCurrencyList.USD, TargetCurrency = EnumCurrencyList.AUD, ConversionRate = (usdRate * rates.AUD), Timestamp = DateTime.Now }); case EnumCurrencyList.SEK: return(new CurrencyRates() { BaseCurrency = EnumCurrencyList.USD, TargetCurrency = EnumCurrencyList.SEK, ConversionRate = (usdRate * rates.USD), Timestamp = DateTime.Now }); case EnumCurrencyList.GBP: return(new CurrencyRates() { BaseCurrency = EnumCurrencyList.USD, TargetCurrency = EnumCurrencyList.GBP, ConversionRate = (usdRate * rates.GBP), Timestamp = DateTime.Now }); case EnumCurrencyList.EUR: return(new CurrencyRates() { BaseCurrency = EnumCurrencyList.USD, TargetCurrency = EnumCurrencyList.EUR, ConversionRate = usdRate, Timestamp = DateTime.Now }); } return(null); }