Пример #1
0
        private List <Question> GetAnswers(GroupDeclaration groupDeclaration)
        {
            var result = new List <Question>(groupDeclaration.Declarations[0].Questions);

            foreach (var declaration in groupDeclaration.Declarations.Skip(1))
            {
                result = result.Intersect(declaration.Questions).ToList();
            }

            return(result);
        }
Пример #2
0
        private HashSet <Question> GetAnswers(GroupDeclaration groupDeclaration)
        {
            var result = new HashSet <Question>();

            foreach (var declaration in groupDeclaration.Declarations)
            {
                result.UnionWith(declaration.Questions.Where(x => x.Answer == true));
            }

            return(result);
        }
Пример #3
0
        private List <GroupDeclaration> CreateGroupsDeclarations(List <List <string> > groups)
        {
            var groupDeclarations = new List <GroupDeclaration>();

            foreach (var group in groups)
            {
                var groupDeclaration = new GroupDeclaration();
                foreach (var person in group)
                {
                    var personDeclaration = new PersonDeclaration();
                    foreach (var question in person)
                    {
                        personDeclaration.AddQuestion(question.ToString(), true);
                    }
                    groupDeclaration.AddPersonDeclaration(personDeclaration);
                }
                groupDeclarations.Add(groupDeclaration);
            }

            return(groupDeclarations);
        }