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); }
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); }