public ActionResult DeleteConfirmed(int id) { WhiskeyModel whiskeyModel = db.Whiskeys.Find(id); db.Whiskeys.Remove(whiskeyModel); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,Name,Age,Region,AlcoholPercentage,Type,Label,AvalableAmount")] WhiskeyModel whiskeyModel) { if (ModelState.IsValid) { db.Entry(whiskeyModel).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(whiskeyModel)); }
public ActionResult Create([Bind(Include = "ID,Name,Age,Region,AlcoholPercentage,Type,Label,AvalableAmount")] WhiskeyModel whiskeyModel) { if (ModelState.IsValid) { db.Whiskeys.Add(whiskeyModel); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(whiskeyModel)); }
// GET: Whiskey/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WhiskeyModel whiskeyModel = db.Whiskeys.Find(id); if (whiskeyModel == null) { return(HttpNotFound()); } return(View(whiskeyModel)); }