Пример #1
0
 public void AddCustomerRecursively(Customer c)
 {
     CMgr.AddCustomer(c);
     foreach (Account a in c.Accounts)
     {
         AMgr.AddAccount(a);
         foreach (Transaction t in a.Transactions)
         {
             TMgr.AddTransaction(t);
         }
     }
 }
Пример #2
0
        public async Task <IActionResult> Deposit(DepositViewModel viewModel)
        {
            viewModel.Customer = await CMgr.GetCustomerAsync(CustomerID);

            viewModel.Validate(ModelState);
            if (!ModelState.IsValid)
            {
                return(View(viewModel));
            }

            await AMgr.DepositAsync(viewModel.Account, viewModel.Amount, viewModel.Comment);

            viewModel.OperationStatus = OperationStatus.Successful;
            viewModel.Clear();
            return(View(viewModel));
        }
Пример #3
0
        public async Task <IActionResult> StatementsResult(int?page = 1)
        {
            int?accountNumber = HttpContext.Session.GetInt32(statementsResultSessionKey);

            if (accountNumber == null)
            {
                return(RedirectToAction("Statements"));
            }

            var account = await AMgr.GetAccountAsync(accountNumber.Value);

            IPagedList <Transaction> transactions = await AMgr.GetPagedTransactionsAsync(accountNumber.Value, page);

            return(View(new StatementsResultViewModel {
                Transactions = transactions, Account = account
            }));
        }
Пример #4
0
        public Account GetPagedStatementByAccountNumber(int accNo, int page)
        {
            Account a = AMgr.GetAccountByAccountNumber(accNo);

            if (a is null)
            {
                throw new KeyNotFoundException(
                          "no account with this account number exists");
            }

            List <Transaction> tHistory = TMgr.GetTransactionsForAccount(accNo,
                                                                         TransactionPageSize, page);

            a.Transactions = tHistory;

            return(a);
        }
Пример #5
0
 public List <Account> GetAccountsForCustomer(int custId)
 {
     return(AMgr.GetAccountsForCustomer(custId));
 }
Пример #6
0
 public void Transfer(int srcNo, int destNo, decimal amount,
                      string comment)
 {
     AMgr.Transfer(srcNo, destNo, amount, comment);
 }
Пример #7
0
 public void WithDraw(int accNo, decimal amount, string comment)
 {
     AMgr.WithDraw(accNo, amount, comment);
 }
Пример #8
0
 public void Deposit(int accNo, decimal amount, string comment)
 {
     AMgr.Deposit(accNo, amount, comment);
 }
Пример #9
0
 public Account GetAccountByAccountNumber(int accNo)
 {
     return(AMgr.GetAccountByAccountNumber(accNo));
 }