public ActionResult DeleteConfirmed(int id) { GoldState goldstate = (GoldState)db.AccountStates.Find(id); db.AccountStates.Remove(goldstate); db.SaveChanges(); return(RedirectToAction("Index")); }
// // GET: /GoldState/Delete/5 public ActionResult Delete(int id = 0) { GoldState goldstate = (GoldState)db.AccountStates.Find(id); if (goldstate == null) { return(HttpNotFound()); } return(View(goldstate)); }
public ActionResult Edit(GoldState goldstate) { if (ModelState.IsValid) { db.Entry(goldstate).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(goldstate)); }
// // GET: /GoldState/Edit/5 public ActionResult Edit(int id = 0) { GoldState goldstate = db.GoldStates.Find(id); if (goldstate == null) { return(HttpNotFound()); } return(View(goldstate)); }
public ActionResult Create(GoldState goldstate) { if (ModelState.IsValid) { db.AccountStates.Add(goldstate); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(goldstate)); }
// // GET: /GoldState/Edit/5 public ActionResult Edit(int id = 0) { //Casted AccountState to a GoldState GoldState goldstate = (GoldState)db.AccountStates.Find(id); if (goldstate == null) { return(HttpNotFound()); } return(View(goldstate)); }
private void EvaluateState() { if (Balance <= 5000) { State = new SilverState(); } if (Balance > 5000 && Balance < 10000) { State = new GoldState(); } if (Balance >= 10000) { State = new PlatinumState(); } }
//Organizing Data - Replace Type Code with State/Strategy public static State CreateAccount(int firstDeposit, Account account) { State created; if (firstDeposit > 10000) { created = new GoldState(firstDeposit, account); } else if (firstDeposit > 5000) { created = new SilverState(firstDeposit, account); } else { created = new BronzeState(firstDeposit, account); } return(created); }
// // GET: /GoldState/ public ActionResult Index() { return(View(GoldState.GetInstance())); }
// // GET: /GoldState/ public ActionResult Index() { //Returns the goldstate account state instance return(View(GoldState.GetInstance())); }