public List <decimal> GetExchangeRateForChart(Currency currency, TypeOfExchange type)
 {
     return(_dbSet
            .Where(x => x.TypeOfExch == type)
            .Where(x => x.Currency == currency)
            .Select(x => x.ExchRate)
            .ToList());
 }
        private static void SaveExchangeRateHistory(
            Currency currency, TypeOfExchange typeOfExchange, decimal exchRate, string exchRateDate,
            IExchangeRateToUsdHistoryRepository exchangeRateToUsdHistoryRepository)
        {
            var exchangeRate = new ExchangeRateToUsdHistory()
            {
                Currency     = currency,
                TypeOfExch   = typeOfExchange,
                ExchRate     = exchRate,
                ExchRateDate = Convert.ToDateTime(exchRateDate)
            };

            exchangeRateToUsdHistoryRepository.Save(exchangeRate);
        }
 public ExchangeRateToUsdCurrent GetExchangeRate(Currency currency, TypeOfExchange type)
 {
     return(_dbSet.SingleOrDefault(x =>
                                   x.Currency == currency &&
                                   x.TypeOfExch == type));
 }
        public void PutToExchangeAccountHistory(Currency currencyFrom, Currency currencyTo, TypeOfExchange typeOfExch,
                                                decimal exchRate, decimal amount, User owner)
        {
            var exchangeAccountHistoryDb = new ExchangeAccountHistory
            {
                CurrencyFrom = currencyFrom,
                CurrencyTo   = currencyTo,
                TypeOfExch   = typeOfExch,
                ExchRate     = exchRate,
                Amount       = amount,
                ExchDate     = DateTime.Now,
                Owner        = owner
            };

            _exchangeAccountHistoryRepository.Save(exchangeAccountHistoryDb);
        }