public static bool IsSA(this User user) { GMRService<Module> modulesvr = new GMRService<Module>(); var SAModule = modulesvr.FirstOrDefault(p => p.Keys == "SA"); if (SAModule == null) return false; var permission = user.Permissions.Where(p => p.ModuleID == SAModule.ModuleID).FirstOrDefault(); return permission != null; }
public ActionResult GroupEdit(int id) { GMRService<Module> service = new GMRService<Module>(); GMRService<Group> groupService = new GMRService<Group>(); EditGroupPermissionModel model = new EditGroupPermissionModel() { GroupId = id, Name = groupService.FirstOrDefault(p=>p.GroupID == id).GroupName, Modules = service.GetPaged(p => p.Keys!= "SA", new IOrderByClause<Module>[] { new OrderByClause<Module, string>(p => p.Name, SortDirection.Ascending) }, 1, int.MaxValue) }; return View(model); }