public void UpdateTables(Accounts model, int type, int change) { Transactions updateTransactions = new Transactions(); updateTransactions.TransactionType = type; updateTransactions.AccountID = model.AccountID; db.Transactions.Add(updateTransactions); if (type == 1) { Deposits updateDeposits = new Deposits(); updateDeposits.TransactionID = updateTransactions.TransactionID; updateDeposits.Amount = change; db.Deposits.Add(updateDeposits); } else { Withdrawls updateWithdrawals = new Withdrawls(); updateWithdrawals.TransactionID = updateTransactions.TransactionID; updateWithdrawals.Amount = change; db.Withdrawls.Add(updateWithdrawals); } db.SaveChanges(); }
public ActionResult Withdraw(Withdrawls model) { TransactionService svc = new TransactionService(); var account = svc.MakeWithdrawal((Accounts)Session["CurrentUser"], (int)model.Amount); return(RedirectToAction("Details", account)); }
private void frmBanking_Load(object sender, EventArgs e) { dgvCustomers.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dgvCustomers.MultiSelect = false; try { withdrawls = new Withdrawls(); deposits = new Deposits(); customers = new Customers(); customers.GetAll(); deposits.GetAll(); withdrawls.GetAll(); Rebind(); } catch (Exception ex) { lblStatus.Text = ex.Message; lblStatus.ForeColor = Color.Red; } }