Пример #1
0
 // GET: User/Create
 public ActionResult Create()
 {
     ViewBag.RolId = new SelectList(DBContext.tblRol, "Id", "Name");
     tblUser user = new tblUser();
     user.AllPreferences = db.tblPreference.ToList();
     user.SelectedPreferences = new List<tblPreference>();
     user.PostedReference = new PostedPreference();
     user.PostedReference.preferenceId = new string[0];
     return View(user);
 }
Пример #2
0
 public ActionResult Edit(tblUser tblUser)
 {
     if (ModelState.IsValid)
     {
         DBContext.Entry(tblUser).State = EntityState.Modified;
         DBContext.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.RolId = new SelectList(DBContext.tblRol, "Id", "Name", tblUser.RolId);
     return View(tblUser);
 }