private static double?FixRate(ExchangeRatesValues values, CurrencySymbol e) { var t = values?.GetType().GetProperty($"{e}")?.GetValue(values, null).To <double?>(); if (!t.HasValue) { return(1); } return(t.Value == 0 ? 1 : t.Value); }
private static List <OrderCloudIntegrationsConversionRate> MapRates(ExchangeRatesValues ratesValues = null) { return(Enum.GetValues(typeof(CurrencySymbol)).Cast <CurrencySymbol>().Select(e => new OrderCloudIntegrationsConversionRate() { Currency = e, Icon = GetIcon(e), Symbol = SymbolLookup.CurrencySymbolLookup.FirstOrDefault(s => s.Key == e).Value.Symbol, Name = SymbolLookup.CurrencySymbolLookup.FirstOrDefault(s => s.Key == e).Value.Name, Rate = FixRate(ratesValues, e) }).ToList()); }