예제 #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));
 }