Esempio n. 1
0
        public ActionResult Create(User user)
        {
            if (ModelState.IsValid)
            {
                user.UserId = Guid.NewGuid();
                db.Users.Add(user);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.UserGroupId = new SelectList(db.UserGroups, "UserGroupID", "Name", user.UserGroupId);
            return View(user);
        }
Esempio n. 2
0
 public ActionResult Edit(User user)
 {
     if (ModelState.IsValid)
     {
         db.Entry(user).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.UserGroupId = new SelectList(db.UserGroups, "UserGroupID", "Name", user.UserGroupId);
     return View(user);
 }
Esempio n. 3
0
 public void Delete(User user)
 {
     db.Users.Remove(user);
     db.SaveChanges();
 }
Esempio n. 4
0
 public void Edit(User user)
 {
     db.Entry(user).State = EntityState.Modified;
     db.SaveChanges();
 }
Esempio n. 5
0
 public void Add(User user)
 {
     db.Users.Add(user);
     db.SaveChanges();
 }