public ActionResult DeleteConfirmed(int id) { PantryOwner pantryOwner = db.PantryOwners.Find(id); db.PantryOwners.Remove(pantryOwner); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,FirstName,LastName,DOB,AddressID")] PantryOwner pantryOwner) { if (ModelState.IsValid) { db.Entry(pantryOwner).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AddressID = new SelectList(db.Addresses, "Id", "StreetAddress", pantryOwner.AddressID); return(View(pantryOwner)); }
// GET: PantryOwners/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PantryOwner pantryOwner = db.PantryOwners.Find(id); if (pantryOwner == null) { return(HttpNotFound()); } return(View(pantryOwner)); }
// GET: PantryOwners/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PantryOwner pantryOwner = db.PantryOwners.Find(id); if (pantryOwner == null) { return(HttpNotFound()); } ViewBag.AddressID = new SelectList(db.Addresses, "Id", "StreetAddress", pantryOwner.AddressID); return(View(pantryOwner)); }