public ActionResult DeleteConfirmed(int id) { ChequingAccount chequingaccount = (ChequingAccount)db.BankAccounts.Find(id); db.BankAccounts.Remove(chequingaccount); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { //The delete method,find the id for the chequing account. ChequingAccount chequingaccount = db.ChequingAccounts.Find(id); db.BankAccounts.Remove(chequingaccount); db.SaveChanges(); return(RedirectToAction("Index")); }
// // GET: /ChequingAccount/Details/5 public ActionResult Details(int id = 0) { ChequingAccount chequingaccount = (ChequingAccount)db.BankAccounts.Find(id); if (chequingaccount == null) { return(HttpNotFound()); } return(View(chequingaccount)); }
// // GET: /Chequing/Delete/5 public ActionResult Delete(int id = 0) { ChequingAccount chequingaccount = db.ChequingAccounts.Find(id); if (chequingaccount == null) { return(HttpNotFound()); } return(View(chequingaccount)); }
// // GET: /ChequingAccount/Delete/5 public ActionResult Delete(int id = 0) { //Assigned chequing account to this ,it was previously just account state. ChequingAccount chequingaccount = db.ChequingAccounts.Find(id); if (chequingaccount == null) { return(HttpNotFound()); } return(View(chequingaccount)); }
// // GET: /ChequingAccount/Edit/5 public ActionResult Edit(int id = 0) { ChequingAccount chequingaccount = (ChequingAccount)db.BankAccounts.Find(id); if (chequingaccount == null) { return(HttpNotFound()); } ViewBag.AccountStateId = new SelectList(db.AccountStates, "AccountStateId", "Description", chequingaccount.AccountStateId); ViewBag.ClientId = new SelectList(db.Clients, "ClientId", "FullName", chequingaccount.ClientId); return(View(chequingaccount)); }
public ActionResult Edit(ChequingAccount chequingaccount) { if (ModelState.IsValid) { db.Entry(chequingaccount).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AccountStateId = new SelectList(db.AccountStates, "AccountStateID", "AccountStateID", chequingaccount.AccountStateId); ViewBag.ClientId = new SelectList(db.Clients, "ClientId", "FirstName", chequingaccount.ClientId); return(View(chequingaccount)); }
// // GET: /Chequing/Edit/5 public ActionResult Edit(int id = 0) { ChequingAccount chequingaccount = db.ChequingAccounts.Find(id); if (chequingaccount == null) { return(HttpNotFound()); } //Modified the following parameters to include FullName and NOT FirstName ViewBag.ClientId = new SelectList(db.Clients, "ClientId", "FullName", chequingaccount.ClientId); ViewBag.AccountStateId = new SelectList(db.AccountStates, "AccountStateId", "Description", chequingaccount.AccountStateId); return(View(chequingaccount)); }
public ActionResult Create(ChequingAccount chequingaccount) { if (ModelState.IsValid) { db.BankAccounts.Add(chequingaccount); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AccountStateId = new SelectList(db.AccountStates, "AccountStateID", "AccountStateID", chequingaccount.AccountStateId); ViewBag.ClientId = new SelectList(db.Clients, "ClientId", "FirstName", chequingaccount.ClientId); return(View(chequingaccount)); }
// // GET: /ChequingAccount/Edit/5 public ActionResult Edit(int id = 0) { ChequingAccount chequingaccount = db.ChequingAccounts.Find(id); if (chequingaccount == null) { return(HttpNotFound()); } ViewBag.AccountStatusId = new SelectList(db.AccountStatus, "AccountStatusId", "Description", chequingaccount.AccountStatusId); //display fullnam instead of firstname //ViewBag.ClientId = new SelectList(db.Clients, "ClientId", "FirstName", chequingaccount.ClientId); ViewBag.ClientId = new SelectList(db.Clients, "ClientId", "FullName", chequingaccount.ClientId); return(View(chequingaccount)); }
public ActionResult Edit(ChequingAccount chequingaccount) { if (ModelState.IsValid) { db.Entry(chequingaccount).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AccountStatusId = new SelectList(db.AccountStatus, "AccountStatusId", "Description", chequingaccount.AccountStatusId); //display fullnam instead of firstname //ViewBag.ClientId = new SelectList(db.Clients, "ClientId", "FirstName", chequingaccount.ClientId); ViewBag.ClientId = new SelectList(db.Clients, "ClientId", "FullName", chequingaccount.ClientId); return(View(chequingaccount)); }
public ActionResult Edit(ChequingAccount chequingaccount) { if (ModelState.IsValid) { db.Entry(chequingaccount).State = EntityState.Modified; db.SaveChanges(); chequingaccount.ChangeState(); db.SaveChanges(); return(RedirectToAction("Index")); } //Modified the following parameters to include FullName and NOT FirstName ViewBag.ClientId = new SelectList(db.Clients, "ClientId", "FullName", chequingaccount.ClientId); ViewBag.AccountStateId = new SelectList(db.AccountStates, "AccountStateId", "Description", chequingaccount.AccountStateId); return(View(chequingaccount)); }
public ActionResult Edit(ChequingAccount chequingaccount) { chequingaccount.SetNextAccountNumber(); if (ModelState.IsValid) { db.Entry(chequingaccount).State = EntityState.Modified; db.SaveChanges(); chequingaccount.ChangeState(); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AccountStateId = new SelectList(db.AccountStates, "AccountStateId", "Description", chequingaccount.AccountStateId); ViewBag.ClientId = new SelectList(db.Clients, "ClientId", "FullName", chequingaccount.ClientId); return(View(chequingaccount)); }
public ActionResult Create(ChequingAccount chequingaccount) { //this code has been modified if (ModelState.IsValid) { //Setting the chequing account number to the next available one when creating a new chequing account chequingaccount.SetNextAccountNumber(); db.BankAccounts.Add(chequingaccount); chequingaccount.ChangeState(); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AccountStateId = new SelectList(db.AccountStates, "AccountStateId", "Description", chequingaccount.AccountStateId); ViewBag.ClientId = new SelectList(db.Clients, "ClientId", "FullName", chequingaccount.ClientId); return(View(chequingaccount)); }
public ActionResult Create(ChequingAccount chequingaccount) { //calling the appropriate SetNext method chequingaccount.SetNextAccountNumber(); if (ModelState.IsValid) { db.BankAccounts.Add(chequingaccount); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AccountStatusId = new SelectList(db.AccountStatus, "AccountStatusId", "Description", chequingaccount.AccountStatusId); //display fullnam instead of firstname //ViewBag.ClientId = new SelectList(db.Clients, "ClientId", "FirstName", chequingaccount.ClientId); ViewBag.ClientId = new SelectList(db.Clients, "ClientId", "FullName", chequingaccount.ClientId); return(View(chequingaccount)); }
public ActionResult Edit(ChequingAccount chequingaccount) { if (ModelState.IsValid) { db.Entry(chequingaccount).State = EntityState.Modified; db.SaveChanges(); //If the conditions for this account's state is not fullfilled,change the state for the account. chequingaccount.ChangeState(); //Save the changes right after the change. db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ClientId = new SelectList(db.Clients, "ClientId", "FullName", chequingaccount.ClientId); ViewBag.AccountStateId = new SelectList(db.AccountStates, "AccountStateId", "Description", chequingaccount.AccountStateId); return(View(chequingaccount)); }
public ActionResult Create(ChequingAccount chequingaccount) { //Added this line of code to set the next account number chequingaccount.SetNextAccountNumber(); if (ModelState.IsValid) { db.BankAccounts.Add(chequingaccount); db.SaveChanges(); chequingaccount.ChangeState(); db.SaveChanges(); return(RedirectToAction("Index")); } //Modified the following parameters to include FullName and NOT FirstName ViewBag.ClientId = new SelectList(db.Clients, "ClientId", "FullName", chequingaccount.ClientId); ViewBag.AccountStateId = new SelectList(db.AccountStates, "AccountStateId", "Description", chequingaccount.AccountStateId); return(View(chequingaccount)); }
public ActionResult Create(ChequingAccount chequingaccount) { //Calling method for auto increment. chequingaccount.SetNextAccountNumber(); if (ModelState.IsValid) { db.BankAccounts.Add(chequingaccount); db.SaveChanges(); //code for database chequingaccount.ChangeState(); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ClientId = new SelectList(db.Clients, "ClientId", "FullName", chequingaccount.ClientId); ViewBag.AccountStateId = new SelectList(db.AccountStates, "AccountStateId", "Description", chequingaccount.AccountStateId); return(View(chequingaccount)); }
static void Main(string[] args) { SavingsAccount sav = new SavingsAccount(5, 0.12); ChequingAccount che = new ChequingAccount(5, 0.12); GlobalSavingsAccount glo = new GlobalSavingsAccount(5, 0.12); Boolean success1 = false; while (success1 == false) { try { Console.WriteLine("A: Savings B: Checking C: GlobalSavings Q: Exit"); String s = Console.ReadLine(); switch (s.ToUpper()) { case "A": Console.WriteLine("A: Deposit B: Withdrawal C: Close + Report R: Return to Bank Menu"); String a = Console.ReadLine(); switch (a.ToUpper()) { case "A": Console.WriteLine("How much would you like to deposit?"); string depositString = Console.ReadLine(); double deposit = Convert.ToDouble(depositString); sav.MakeDeposit(deposit); break; case "B": Console.WriteLine("How much would you like to withdraw?"); string withdrawString = Console.ReadLine(); double withdraw = Convert.ToDouble(withdrawString); sav.MakeWithdrawl(withdraw); break; case "C": Console.Write(sav.CloseAndReport()); break; case "R": // come back break; } break; case "B": Console.WriteLine("A: Deposit B: Withdrawal C: Close + Report R: Return to Bank Menu"); String b = Console.ReadLine(); switch (b.ToUpper()) { case "A": Console.WriteLine("How much would you like to deposit?"); string depositString = Console.ReadLine(); double deposit = Convert.ToDouble(depositString); che.MakeDeposit(deposit); break; case "B": Console.WriteLine("How much would you like to withdraw?"); string withdrawString = Console.ReadLine(); double withdraw = Convert.ToDouble(withdrawString); che.MakeWithdrawl(withdraw); break; case "C": Console.Write(che.CloseAndReport()); break; case "R": //come back break; } break; case "C": Console.WriteLine("A: Deposit B: Withdrawal C: Close + Report D: Report Balance in USD R: Return to Bank Menu"); String c = Console.ReadLine(); switch (c.ToUpper()) { case "A": Console.WriteLine("How much would you like to deposit?"); string depositString = Console.ReadLine(); double deposit = Convert.ToDouble(depositString); glo.MakeDeposit(deposit); break; case "B": Console.WriteLine("How much would you like to withdraw?"); string withdrawString = Console.ReadLine(); double withdraw = Convert.ToDouble(withdrawString); glo.MakeWithdrawl(withdraw); break; case "C": Console.WriteLine(glo.CloseAndReport()); break; case "D": Console.WriteLine(glo.USValue(0.76)); break; case "R": //Come back break; } break; case "Q": success1 = true; break; } } catch (Exception e) { Console.WriteLine("Entered a incorrect value. "); } finally { } } }
static void Main(string[] args) { double annualInterest = 10.00; bool endProg = false; Console.WriteLine("Welcome to Atlas Banking System V4.79"); Thread.Sleep(3000); Console.WriteLine("Created by Cristian and Louis-Philippe"); Console.WriteLine(""); Thread.Sleep(2000); Console.Write("Loading."); Thread.Sleep(1000); Console.Write("."); Thread.Sleep(1000); Console.Write("."); Thread.Sleep(1000); Console.WriteLine(" Done!"); SavingAccount s1 = new SavingAccount(5.00, annualInterest); ChequingAccount c1 = new ChequingAccount(5.00, annualInterest); GlobalSavingAccount g1 = new GlobalSavingAccount(5.00, annualInterest); while (endProg != true) { Console.WriteLine("\nBANK MENU:"); Console.WriteLine("A: Savings"); Console.WriteLine("B: Checkings"); Console.WriteLine("C: Global Savings"); Console.WriteLine("Q: Exit"); Console.WriteLine("\nChoose an option from above:"); string option = Console.ReadLine(); //-------------------------------- if (option.ToLower() == "q" || option.ToLower() == "exit") { Console.WriteLine("Goodbye!"); endProg = true; } //------------------------------- if (option.ToLower() == "a" || option.ToLower() == "savings") { bool returnMenu = false; Math.Round(s1.currentBalance); while (returnMenu != true) { Console.WriteLine("\nSAVINGS ACCOUNT MENU:"); Console.WriteLine("Current Balance in savings account: $" + s1.currentBalance.ToString("0.00")); Console.WriteLine("-------------------------------------------"); Console.WriteLine("A: Deposit"); Console.WriteLine("B: Withdrawal"); Console.WriteLine("C: Close and Report"); Console.WriteLine("R: Return to Menu"); Console.WriteLine("\nChoose an option from above:"); string option2 = Console.ReadLine(); if (option2.ToLower() == "a" || option2.ToLower() == "deposit") { Console.WriteLine("\nEnter amount to deposit: "); try { double depo = Convert.ToDouble(Console.ReadLine()); s1.MakeADeposit(depo); Console.WriteLine("\nNumber of deposit made: " + s1.amountOfDeposit); } catch (Exception e) { Console.WriteLine("\nError: Value must be a number"); } continue; } if (option2.ToLower() == "b" || option2.ToLower() == "withdrawal") { try { Console.WriteLine("\nEnter amount to withdraw: "); double wit = Convert.ToDouble(Console.ReadLine()); s1.MakeWithdraw(wit); Console.WriteLine("\nNumber of withdrawal made: " + s1.amountOfWithdrawal); } catch (Exception e) { Console.WriteLine("\nError: Value must be a number"); } continue; } if (option2.ToLower() == "c" || option2.ToLower() == "closereport") { if (s1.reportLimit == false) { Console.WriteLine("\n\nHere is the report.\n"); s1.closeAndReportSaving(); continue; } if (s1.reportLimit == true) { Console.WriteLine(""); Console.WriteLine("Error: Please make another operation before requesting a report."); } } if (option2.ToLower() == "r" || option2.ToLower() == "return" || option.ToLower() == "return menu") { returnMenu = true; continue; } if (option2.ToLower() != "a" || option2.ToLower() != "deposit" || option2.ToLower() != "b" || option2.ToLower() != "withdrawal" || option2.ToLower() != "c" || option2.ToLower() != "closereport" || option2.ToLower() != "r" || option2.ToLower() != "return" || option.ToLower() != "return menu") { Console.WriteLine("\nError: Invalid option"); continue; } } } if (option.ToLower() == "b" || option.ToLower() == "checking") { bool returnMenu = false; Math.Round(c1.currentBalance); while (returnMenu != true) { Console.WriteLine("\nCHECKINGS ACCOUNT MENU"); Console.WriteLine("Current Balance in chequing account: $" + c1.currentBalance.ToString("0.00")); Console.WriteLine("-------------------------------------------"); Console.WriteLine("A: Deposit"); Console.WriteLine("B: Withdrawal"); Console.WriteLine("C: Close and Report"); Console.WriteLine("R: Return to Menu"); Console.WriteLine("\nChoose an option from above:"); string option2 = Console.ReadLine(); if (option2.ToLower() == "a" || option2.ToLower() == "deposit") { try { Console.WriteLine("\nEnter amount to deposit: "); double depo = Convert.ToDouble(Console.ReadLine()); c1.MakeADeposit(depo); Console.WriteLine("\nNumber of deposit made: " + c1.amountOfDeposit); } catch (Exception e) { Console.WriteLine("\nError: Value must be a number"); } continue; } if (option2.ToLower() == "b" || option2.ToLower() == "withdrawal") { try { Console.WriteLine("\nEnter amount to withdraw: "); double wit = Convert.ToDouble(Console.ReadLine()); c1.MakeWithdraw(wit); Console.WriteLine("\nNumber of withdrawal made: " + c1.amountOfWithdrawal); } catch (Exception e) { Console.WriteLine("\nError: Value must be a number"); } continue; } if (option2.ToLower() == "c" || option2.ToLower() == "closereport") { if (c1.reportLimit == false) { Console.WriteLine("\n\nHere is the report.\n"); c1.closeAndReportChequing(); continue; } if (c1.reportLimit == true) { Console.WriteLine(""); Console.WriteLine("Error: Please make another operation before requesting a report."); } } if (option2.ToLower() == "r" || option2.ToLower() == "return" || option.ToLower() == "return menu") { returnMenu = true; continue; } if (option2.ToLower() != "a" || option2.ToLower() != "deposit" || option2.ToLower() != "b" || option2.ToLower() != "withdrawal" || option2.ToLower() != "c" || option2.ToLower() != "closereport" || option2.ToLower() != "r" || option2.ToLower() != "return" || option2.ToLower() != "return menu") { Console.WriteLine("\nError: Invalid option"); continue; } } } if (option.ToLower() == "c" || option.ToLower() == "global savings" || option.ToLower() == "globalsavings") { bool returnMenu = false; Math.Round(g1.currentBalance); while (returnMenu != true) { Console.WriteLine("\nGLOBAL SAVINGS ACCOUNT MENU"); Console.WriteLine("Current Balance in global savings account: $" + g1.currentBalance.ToString("0.00")); Console.WriteLine("-------------------------------------------"); Console.WriteLine("A: Deposit"); Console.WriteLine("B: Withdrawal"); Console.WriteLine("C: Close and Report"); Console.WriteLine("D: Report Balance in USD"); Console.WriteLine("R: Return to Menu"); Console.WriteLine("\nChoose an option from above:"); string option2 = Console.ReadLine(); if (option2.ToLower() == "a" || option2.ToLower() == "deposit") { try { Console.WriteLine("\nEnter amount to deposit: "); double depo = Convert.ToDouble(Console.ReadLine()); g1.MakeADeposit(depo); Console.WriteLine("\nNumber of deposit made: " + g1.amountOfDeposit); } catch (Exception e) { Console.WriteLine("Error: Value must be a number"); } continue; } if (option2.ToLower() == "b" || option2.ToLower() == "withdrawal") { try { Console.WriteLine("\nEnter amount to withdraw: "); double wit = Convert.ToDouble(Console.ReadLine()); g1.MakeWithdraw(wit); Console.WriteLine("\nNumber of withdrawal made: " + g1.amountOfWithdrawal); } catch (Exception e) { Console.WriteLine("Error: Value must be a number"); } continue; } if (option2.ToLower() == "c" || option2.ToLower() == "closereport") { if (g1.reportLimit == false) { Console.WriteLine("\n\nHere is the report.\n"); g1.closeAndReportSaving(); continue; } if (g1.reportLimit == true) { Console.WriteLine(""); Console.WriteLine("Error: Please make another operation before requesting a report."); } } if (option2.ToLower() == "d" || option2.ToLower() == "balanceUS") { Console.WriteLine("\nHere are the balance in USD:"); Math.Round(g1.USValue(0.76), 2); Console.WriteLine("$" + g1.USValue(0.76).ToString("0.00")); continue; } if (option2.ToLower() == "r" || option2.ToLower() == "return" || option.ToLower() == "return menu") { returnMenu = true; continue; } if (option2.ToLower() != "r" || option2.ToLower() != "return" || option.ToLower() != "return menu" || option2.ToLower() != "a" || option2.ToLower() != "deposit") { Console.WriteLine("\nError: Invalid option"); continue; } } } if (option.ToLower() != "a" || option.ToLower() != "savings" || option.ToLower() != "b" || option.ToLower() != "checkings" || option.ToLower() != "c" || option.ToLower() != "globalssavings" || option.ToLower() != "r" || option.ToLower() != "return" || option.ToLower() != "return menu") { Console.WriteLine("\nError: Invalid option"); continue; } } }