public void Edit(Authorize authorize) { using (var db = GetJURDataContext()) { var entry = db.Authorizes.Find(authorize.ID); if (entry != null) { db.Entry(entry).CurrentValues.SetValues(authorize); db.SaveChanges(); } } }
public int Add(Authorize authorize) { using (var db = GetJURDataContext()) { var entry = db.Authorizes.FirstOrDefault(e => e.Manager == authorize.Manager); if (entry != null) { throw new ArgumentException("需要修改"+authorize.Manager+"的管理组,请去编辑权限列表"); } db.Authorizes.Add(authorize); db.SaveChanges(); return authorize.ID; } }
public ActionResult Impower(Authorize authorize) { try { Core.AuthorizeManager.Add(Core.AuthorizeManager.Get(HttpContext)); } catch (Exception ex) { throw new ArgumentException(ex.Message); } ViewBag.List = Core.AuthorizeManager.GetList(); ViewBag.Groups = ADController.GetGroupList().ListToTable(); return View(); }