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