public ActionResult DeleteConfirmed(int id) { BobbleHead bobbleHead = db.BobbleHeads.Find(id); db.BobbleHeads.Remove(bobbleHead); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,superHeroName")] BobbleHead bobbleHead) { if (ModelState.IsValid) { db.Entry(bobbleHead).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(bobbleHead)); }
public ActionResult Create([Bind(Include = "ID,superHeroName")] BobbleHead bobbleHead) { if (ModelState.IsValid) { db.BobbleHeads.Add(bobbleHead); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(bobbleHead)); }
// GET: BobbleHeads/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BobbleHead bobbleHead = db.BobbleHeads.Find(id); if (bobbleHead == null) { return(HttpNotFound()); } return(View(bobbleHead)); }