public async Task <IActionResult> AccountTransfers(int id, string fromDate, string toDate, string excel, string fullName, int page = 1)
        {
            User user = userService.FindUserByName(User.Identity.Name);


            List <StatementObjectViewModel> transfers = await transferService.GetAccountTransfers(id);

            if (fromDate != null)
            {
                transfers = transfers.Where(t => t.TransferDate >= DateTime.Parse(fromDate)).ToList();
            }
            if (toDate != null)
            {
                transfers = transfers.Where(t => t.TransferDate <= DateTime.Parse(toDate)).ToList();
            }
            Account account = await accountService.FindAccountById(id);

            List <ExchangeRate>       rates = exchangeRateService.GetExchangeRates();
            AccountTransfersViewModel model = new AccountTransfersViewModel {
                Transfers = transfers, Account = account, FromDate = fromDate, ToDate = toDate, FullName = fullName, Rates = rates
            };

            if (excel == "True")
            {
                return(ExportToExcel(model));
            }

            return(View(model));
        }
Exemplo n.º 2
0
        public void GetExchangeRates()
        {
            List <ExchangeRate> exchangeList = exchangeRateService.GetExchangeRates();
            var result = context.ExchangeRates.ToList();

            Assert.Equal(exchangeList.Count, result.Count);
            for (int i = 0; i < exchangeList.Count; i++)
            {
                Assert.Equal(exchangeList[i].Id, result[i].Id);
                Assert.Equal(exchangeList[i].RateDate, result[i].RateDate);
                Assert.Equal(exchangeList[i].RateForPurchaise, result[i].RateForPurchaise);
                Assert.Equal(exchangeList[i].RateForSale, result[i].RateForSale);
                Assert.Equal(exchangeList[i].ExchangeRateTypeId, result[i].ExchangeRateTypeId);
                Assert.Equal(exchangeList[i].CurrencyId, result[i].CurrencyId);
            }
        }
        public void GetExchangeRates()
        {
            List <ExchangeRate> exchangeList = exchangeRateService.GetExchangeRates();

            Assert.Equal(exchangeList, context.ExchangeRates.ToList());
        }
        public async Task GetExchangeRatesAsync_Success()
        {
            var result = await _exchangeRateService.GetExchangeRates();

            Assert.IsNotNull(result);
        }