public ActionResult DeleteConfirmed(int id) { Dairy dairy = db.Dairy.Find(id); db.Dairy.Remove(dairy); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "dairyID,dName,dAddress,dCity,StateID,dZip,dPhone")] Dairy dairy) { if (ModelState.IsValid) { db.Entry(dairy).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.StateID = new SelectList(db.State, "StateID", "StateName", dairy.StateID); return(View(dairy)); }
// GET: Dairies/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Dairy dairy = db.Dairy.Find(id); if (dairy == null) { return(HttpNotFound()); } return(View(dairy)); }
// GET: Dairies/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Dairy dairy = db.Dairy.Find(id); if (dairy == null) { return(HttpNotFound()); } ViewBag.StateID = new SelectList(db.State, "StateID", "StateName", dairy.StateID); return(View(dairy)); }