예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            beer beer = db.beers.Find(id);

            db.beers.Remove(beer);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 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));
 }
예제 #3
0
        // 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));
        }
예제 #4
0
        // 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));
        }