Пример #1
0
 public ActionResult Edit(Role role)
 {
     if (ModelState.IsValid)
     {
         //role.Creation
         db.Roles.Attach(role);
         db.ObjectStateManager.ChangeObjectState(role, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(role);
 }
Пример #2
0
        public ActionResult Create(Role role)
        {
            if (ModelState.IsValid)
            {
                role.Creation = DateTime.Now;
                db.Roles.AddObject(role);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(role);
        }