public ExamAnswer GetExamAnswer(RequestGetExamAnswer request)
        {
            ExamAnswerHelper eah = new ExamAnswerHelper();
            ExamAnswer ea = eah.GetRow(request.usercode, request.ExamPaper);

            AnswerHelper ah = new AnswerHelper();
            ea.Answers = ah.GetRows(ea.GUID);

            AnswerItemHelper aih = new AnswerItemHelper();
            var ais = aih.GetRows(ea.GUID);

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

            foreach (var ai in ais)
            {
                if (!items.ContainsKey(ai.Code))
                {
                    items.Add(ai.Code, new List<AnswerItem>());
                }
                 items[ai.Code].Add(ai);
            }

            foreach (var a in ea.Answers)
            {
                a.Answers = items[a.Code];
            }

            return ea;
        }
        public ExamAnswer GetExamAnswer(RequestGetExamAnswer request)
        {
            ExamAnswerHelper eah = new ExamAnswerHelper();
            ExamAnswer       ea  = eah.GetRow(request.usercode, request.ExamPaper);

            AnswerHelper ah = new AnswerHelper();

            ea.Answers = ah.GetRows(ea.GUID);

            AnswerItemHelper aih = new AnswerItemHelper();
            var ais = aih.GetRows(ea.GUID);

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

            foreach (var ai in ais)
            {
                if (!items.ContainsKey(ai.Code))
                {
                    items.Add(ai.Code, new List <AnswerItem>());
                }
                items[ai.Code].Add(ai);
            }

            foreach (var a in ea.Answers)
            {
                a.Answers = items[a.Code];
            }

            return(ea);
        }