public ActionResult Edit([Bind(Include = "ID,Name,AlterEgo,PrimaryAbility,SecondaryAbility,Catchphrase")] Superheromodel superhero) { if (ModelState.IsValid) { db.Entry(superhero).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Include = "ID,Name,AlterEgo,PrimaryAbility,SecondaryAbility,Catchphrase")] Superheromodel superhero) { if (ModelState.IsValid) { db.Superhero.Add(superhero); db.SaveChanges(); return(RedirectToAction("Index")); } return(RedirectToAction("Index")); }
//get // POST: public ActionResult Delete(int id) { Superheromodel superhero = db.Superhero.Find(id); if (superhero == null) { return(RedirectToAction("Index")); } db.Superhero.Remove(superhero); db.SaveChanges(); return(RedirectToAction("Index")); }
//Get: public ActionResult Details(int?id) { if (id == null) { return(RedirectToAction("Index")); } Superheromodel superhero = db.Superhero.Find(id); if (superhero == null) { return(HttpNotFound()); } return(View(superhero)); }