public ActionResult DeleteConfirmed(int id) { PersonEatStory personEatStory = db.PersonEatStories.Find(id); db.PersonEatStories.Remove(personEatStory); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "StoryID,PersonID,DishID,DishWeight,Date")] PersonEatStory personEatStory) { if (ModelState.IsValid) { db.Entry(personEatStory).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.DishID = new SelectList(db.Dishes, "DishID", "DishName", personEatStory.DishID); ViewBag.PersonID = new SelectList(db.Persons, "PersonID", "PersonName", personEatStory.PersonID); return(View(personEatStory)); }
// GET: PersonEatStories/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PersonEatStory personEatStory = db.PersonEatStories.Find(id); if (personEatStory == null) { return(HttpNotFound()); } return(View(personEatStory)); }
// GET: PersonEatStories/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PersonEatStory personEatStory = db.PersonEatStories.Find(id); if (personEatStory == null) { return(HttpNotFound()); } ViewBag.DishID = new SelectList(db.Dishes, "DishID", "DishName", personEatStory.DishID); ViewBag.PersonID = new SelectList(db.Persons, "PersonID", "PersonName", personEatStory.PersonID); return(View(personEatStory)); }