示例#1
0
        public void AssignRoleSecurableAction(int roleId, int securableId)
        {
            RoleAppSecurable newRoleAppSecurable = new RoleAppSecurable()
            {
                RoleId         = roleId,
                AppSecurableId = securableId
            };

            this.tdb.RoleAppSecurables.AddObject(newRoleAppSecurable);

            this.tdb.SaveChanges();
        }
示例#2
0
        public void UnassignRoleSecurableAction(int roleId, int securableId)
        {
            RoleAppSecurable foundRoleAppSecurable =
                this.tdb.RoleAppSecurables.Single(y => y.RoleId == roleId && y.AppSecurableId == securableId);

            if (foundRoleAppSecurable == null)
            {
                throw new Exception(
                          string.Format("Could not find securable {0} associated with role {1}", roleId, securableId));
            }

            this.tdb.RoleAppSecurables.DeleteObject(foundRoleAppSecurable);

            this.tdb.SaveChanges();
        }