예제 #1
0
        public async Task PayBill(BillPay bill, NationBankContext _context)
        {
            Account account = await _context.Accounts.FindAsync(bill.AccountNumber);

            if (account.PayBill(bill.Amount))
            {
                //bill paid
            }
            else
            {
                bill.Block = true; //if not enough balance, block the bill
            }
            // Period cases
            switch (bill.Period)
            {
            case Period.Monthly:
                bill.ScheduleDate = bill.ScheduleDate.AddMonths(1);
                _context.Update(bill);
                break;

            case Period.Annually:
                bill.ScheduleDate = bill.ScheduleDate.AddYears(1);
                _context.Update(bill);
                break;

            case Period.Quarterly:
                bill.ScheduleDate = bill.ScheduleDate.AddMonths(3);
                _context.Update(bill);
                break;

            case Period.Once_off:
                _context.Remove(bill);
                break;
            }
            await _context.SaveChangesAsync();
        }
 public PayeeManager(NationBankContext context)
 {
     _context = context;
 }
 public ATMController(NationBankContext context)
 {
     _context = context;
 }
 public ProfileValidation(NationBankContext context, Controller controller, int CustomerID)
 {
     _context        = context;
     this.controller = controller;
     this.CustomerID = CustomerID;
 }
 public CustomersController(NationBankContext context)
 {
     _context = context;
 }
예제 #6
0
 public TransferManger(NationBankContext context, Controller controller, int CustomerID)
 {
     _context        = context;
     this.controller = controller;
     this.CustomerID = CustomerID;
 }
 public AccountManager(NationBankContext context)
 {
     _context = context;
 }
예제 #8
0
 public LoginsController(NationBankContext context)
 {
     _context = context;
 }
예제 #9
0
 public BillPayManager(NationBankContext context)
 {
     _context = context;
 }
예제 #10
0
 public CustomerManager(NationBankContext context)
 {
     _context = context;
 }
 public TransactionManager(NationBankContext context)
 {
     _context = context;
 }
 public LoginManager(NationBankContext context)
 {
     _context = context;
 }
        private int CustomerID => HttpContext.Session.GetInt32(nameof(Customer.CustomerID)).Value;   //get CustomerID from session

        public MyProfileController(NationBankContext context)
        {
            _context = context;
        }
예제 #14
0
 public async Task Unlock(Login login, NationBankContext _context)
 {
     login.Lock    = false;
     login.attempt = 0;
     await _context.SaveChangesAsync();
 }