public ActionResult Create(Tavolo tavolo) { if (ModelState.IsValid) { db.Tavoloes.Add(tavolo); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.RistoranteId = new SelectList(db.Ristorantes, "Id", "Nome", tavolo.RistoranteId); return View(tavolo); }
public ActionResult Edit(Tavolo tavolo) { if (ModelState.IsValid) { db.Entry(tavolo).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.RistoranteId = new SelectList(db.Ristorantes, "Id", "Nome", tavolo.RistoranteId); return View(tavolo); }