public ActionResult DeleteConfirmed(int id) { SilverState silverstate = (SilverState)db.AccountStates.Find(id); db.AccountStates.Remove(silverstate); db.SaveChanges(); return(RedirectToAction("Index")); }
// // GET: /SilverState/Delete/5 public ActionResult Delete(int id = 0) { SilverState silverstate = (SilverState)db.AccountStates.Find(id); if (silverstate == null) { return(HttpNotFound()); } return(View(silverstate)); }
public ActionResult Edit(SilverState silverstate) { if (ModelState.IsValid) { db.Entry(silverstate).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(silverstate)); }
// // GET: /SilverState/Edit/5 public ActionResult Edit(int id = 0) { SilverState silverstate = db.SilverStates.Find(id); if (silverstate == null) { return(HttpNotFound()); } return(View(silverstate)); }
public ActionResult Create(SilverState silverstate) { if (ModelState.IsValid) { db.AccountStates.Add(silverstate); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(silverstate)); }
// // GET: /SilverState/Edit/5 public ActionResult Edit(int id = 0) { //Casted AccountStates to SilverState SilverState silverstate = (SilverState)db.AccountStates.Find(id); if (silverstate == null) { return(HttpNotFound()); } return(View(silverstate)); }
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: /SilverState/ public ActionResult Index() { return(View(SilverState.GetInstance())); }
public Account() { State = new SilverState(); }
public Account(string p_owner) { Owner = p_owner; State = new SilverState(0.0, this); }
public Account(string owner) { _owner = owner; State = new SilverState(new decimal(0.0), this); }
// // GET: /SilverState/ public ActionResult Index() { //Returns the instance of the Silver state. return(View(SilverState.GetInstance())); }