コード例 #1
0
        public List <Group> GetGroups(Group group)
        {
            List <Group> result = new List <Group>();

            var allGroups = _groupManager.GetGroups();

            var groupsByName = allGroups.Where(x => x.Name.Equals(group.Name)).ToList();

            result = _groupManager.AddToExistingGroups(ref result, groupsByName);

            var groupsByGid = allGroups.Where(x => x.Gid.Equals(group.Gid)).ToList();

            result = _groupManager.AddToExistingGroups(ref result, groupsByGid);

            List <Group> groupsByMembers;

            if (group.Members?.Count > 0)
            {
                groupsByMembers = allGroups.Where(x => x.Members.Intersect(group.Members).Count() == group.Members.Count()).ToList();
                result          = _groupManager.AddToExistingGroups(ref result, groupsByMembers);
            }
            return(result);
        }