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; }
public TransferManger(NationBankContext context, Controller controller, int CustomerID) { _context = context; this.controller = controller; this.CustomerID = CustomerID; }
public AccountManager(NationBankContext context) { _context = context; }
public LoginsController(NationBankContext context) { _context = context; }
public BillPayManager(NationBankContext context) { _context = context; }
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; }
public async Task Unlock(Login login, NationBankContext _context) { login.Lock = false; login.attempt = 0; await _context.SaveChangesAsync(); }