public ActionResult DeleteConfirmed(int id) { beer beer = db.beers.Find(id); db.beers.Remove(beer); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "beerID,breweryID,beerName,beerType,canOrBottle")] beer beer) { if (ModelState.IsValid) { db.Entry(beer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.breweryID = new SelectList(db.breweries, "breweryID", "breweryLocation", beer.breweryID); return(View(beer)); }
// GET: beers/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } beer beer = db.beers.Find(id); if (beer == null) { return(HttpNotFound()); } return(View(beer)); }
// GET: beers/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } beer beer = db.beers.Find(id); if (beer == null) { return(HttpNotFound()); } ViewBag.breweryID = new SelectList(db.breweries, "breweryID", "breweryLocation", beer.breweryID); return(View(beer)); }