Esempio n. 1
0
        public async Task <IActionResult> ViewMyStatement(int?page = 1, AccountType accountType = AccountType.Saving)
        {
            // Retrieve customer object from context
            var customer = await _context.Customers.FindAsync(CustomerID);

            List <Account> accounts = customer.Accounts;

            ViewBag.Customer = customer;

            // Page the orders, maximum of 4 per page.
            const int pageSize = 4;

            ViewMyStatementVM viewModel = ViewMyStatementMediator.GenerateMyStatementViewModel(customer, accountType, (int)page, pageSize);

            return(View(viewModel));
        }
Esempio n. 2
0
        public static async Task <ViewMyStatementVM> Create(Customer customer, AccountType accountType, int page, int pageSize)
        {
            // Generate transactions for view statement
            BankStatementBuilder bankStatementBuilder = new BankStatementBuilder(customer);

            bankStatementBuilder.SetAccountType(accountType);
            BankStatementDirector bankStatementDirector = new BankStatementDirector(bankStatementBuilder);

            bankStatementDirector.ConstructStatement();

            List <Transaction> resultTransactions = bankStatementDirector.GetBankStatementTransactions();
            List <Account>     resultAccounts     = bankStatementDirector.GetMatchedAccounts();

            var pagedList = await resultTransactions.ToPagedListAsync((int)page, pageSize);

            ViewMyStatementVM viewModel = new ViewMyStatementVM()
            {
                Accounts              = resultAccounts,
                SelectedAccountType   = accountType,
                PagedListTransactions = pagedList,
            };

            return(viewModel);
        }