コード例 #1
0
 public ActionResult Edit(ProprietaireTable proprietairetable)
 {
     if (ModelState.IsValid)
     {
         db.Entry(proprietairetable).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.AdresseId = new SelectList(db.AdresseTables, "AdresseId", "AptNo", proprietairetable.AdresseId);
     ViewBag.UserId = new SelectList(db.UserTables, "UserId", "Nom", proprietairetable.UserId);
     return View(proprietairetable);
 }
コード例 #2
0
        public ActionResult Create(ProprietaireTable proprietairetable)
        {
            if (ModelState.IsValid)
            {
                db.ProprietaireTables.Add(proprietairetable);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.AdresseId = new SelectList(db.AdresseTables, "AdresseId", "AptNo", proprietairetable.AdresseId);
            ViewBag.UserId = new SelectList(db.UserTables, "UserId", "Nom", proprietairetable.UserId);
            return View(proprietairetable);
        }