コード例 #1
0
 public void AddUserGroupBaseToGroup(DT.UserGroupBase resource, DT.UserGroup group)
 {
     using (DA.AccessServiceDataContext context = new DA.AccessServiceDataContext()) {
         DA.UserGroupUserGroup ugug = new DA.UserGroupUserGroup();
         ugug.UserGroupId          = resource.Id;
         ugug.UserGroupUserGroupId = group.Id;
         context.UserGroupUserGroups.InsertOnSubmit(ugug);
         context.SubmitChanges();
     }
 }
コード例 #2
0
        public void RemoveUserGroupBaseFromGroup(DT.UserGroupBase resource, DT.UserGroup userGroup)
        {
            using (DA.AccessServiceDataContext context = new DA.AccessServiceDataContext()) {
                var query = from u in context.UserGroupUserGroups
                            where u.UserGroupId == resource.Id && u.UserGroupUserGroupId == userGroup.Id
                            select u;

                if (query.Count() == 1)
                {
                    context.UserGroupUserGroups.DeleteOnSubmit(query.First());
                    context.SubmitChanges();
                }
            }
        }