public ExamQuestion GetExamQuestion(RequestGetExamQuestion request)
        {
            ExamQuestionHelper eqh = new ExamQuestionHelper();
            ExamQuestion       eq  = eqh.GetRow(request.ExamPaper);

            QuestionHelper qh = new QuestionHelper();

            eq.Questions = qh.GetRows(request.ExamPaper);

            QuestionItemHelper qih = new QuestionItemHelper();
            var qis = qih.GetRows(request.ExamPaper);

            Dictionary <string, IList <QuestionItem> > items   = new Dictionary <string, IList <QuestionItem> >();
            Dictionary <string, IList <QuestionItem> > answers = new Dictionary <string, IList <QuestionItem> >();

            foreach (var qi in qis)
            {
                if (!items.ContainsKey(qi.Code))
                {
                    items.Add(qi.Code, new List <QuestionItem>());
                }
                if (!answers.ContainsKey(qi.Code))
                {
                    answers.Add(qi.Code, new List <QuestionItem>());
                }
                items[qi.Code].Add(qi);
                if (!string.IsNullOrWhiteSpace(qi.Value))
                {
                    answers[qi.Code].Add(qi);
                }
            }

            foreach (var q in eq.Questions)
            {
                q.Items   = items[q.Code];
                q.Answers = answers[q.Code];
            }

            return(eq);
        }
        public ExamQuestion GetExamQuestion(RequestGetExamQuestion request)
        {
            ExamQuestionHelper eqh = new ExamQuestionHelper();
            ExamQuestion eq = eqh.GetRow(request.ExamPaper);

            QuestionHelper qh = new QuestionHelper();
            eq.Questions = qh.GetRows(request.ExamPaper);

            QuestionItemHelper qih = new QuestionItemHelper();
            var qis = qih.GetRows(request.ExamPaper);

            Dictionary<string, IList<QuestionItem>> items = new Dictionary<string,IList<QuestionItem>>();
            Dictionary<string, IList<QuestionItem>> answers = new Dictionary<string,IList<QuestionItem>>();

            foreach (var qi in qis)
            {
                if (!items.ContainsKey(qi.Code))
                {
                    items.Add(qi.Code, new List<QuestionItem>());
                }
                 if (!answers.ContainsKey(qi.Code))
                {
                    answers.Add(qi.Code, new List<QuestionItem>());
                }
                items[qi.Code].Add(qi);
                if (!string.IsNullOrWhiteSpace(qi.Value))
                {
                    answers[qi.Code].Add(qi);
                }
            }

            foreach (var q in eq.Questions)
            {
                q.Items = items[q.Code];
                q.Answers = answers[q.Code];
            }

            return eq;
        }