public TestView(PatternView pattern, IEnumerable <QuestionView> questions, IEnumerable <AnswerView> answers)
        {
            Pattern = pattern;

            var questionAnswers = new List <QuestionAnswersView>();

            foreach (var question in questions)
            {
                var variants = answers.Where(x => x.question_Id == question.Id).ToList();

                questionAnswers.Add(new QuestionAnswersView()
                {
                    Question = question,
                    Variants = variants
                });
            }

            Questions = questionAnswers;
        }
        public TestResult(PatternView pattern, IEnumerable <AnswerView> result, IList <Answer> trueAnswer)
        {
            Pattern = pattern;

            double correctAnswers = 0;

            var ids = trueAnswer.Select(x => x.Id).ToList();

            foreach (var item in result)
            {
                if (ids.Contains(item.Id))
                {
                    correctAnswers++;
                }
            }

            Percentage = (int)(100 * (correctAnswers / trueAnswer.Count()));

            Mark = Percentage / 20;

            IsModelValid = true;

            Message = "Ok";
        }
 public DiagramResult(PatternView pattern)
 {
     Pattern = pattern;
 }