コード例 #1
0
        public ActionResult Create(Permission permission)
        {
            if (ModelState.IsValid)
            {
                db.Permissions.Add(permission);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.FeatureID = new SelectList(db.Features, "FeatureID", "FeatureName", permission.FeatureID);
            ViewBag.UserLogin = new SelectList(db.Users, "UserLogin", "Pswd", permission.UserLogin);
            return View(permission);
        }
コード例 #2
0
 public ActionResult Edit(Permission permission)
 {
     if (ModelState.IsValid)
     {
         db.Entry(permission).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.FeatureID = new SelectList(db.Features, "FeatureID", "FeatureName", permission.FeatureID);
     ViewBag.UserLogin = new SelectList(db.Users, "UserLogin", "Pswd", permission.UserLogin);
     return View(permission);
 }