public ActionResult Edit(LocataireTable locatairetable) { if (ModelState.IsValid) { db.Entry(locatairetable).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.AdresseId = new SelectList(db.AdresseTables, "AdresseId", "AptNo", locatairetable.AdresseId); ViewBag.UserId = new SelectList(db.UserTables, "UserId", "Nom", locatairetable.UserId); return View(locatairetable); }
public ActionResult Create(LocataireTable locatairetable) { if (ModelState.IsValid) { db.LocataireTables.Add(locatairetable); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.AdresseId = new SelectList(db.AdresseTables, "AdresseId", "AptNo", locatairetable.AdresseId); ViewBag.UserId = new SelectList(db.UserTables, "UserId", "Nom", locatairetable.UserId); return View(locatairetable); }