Ejemplo n.º 1
0
        public ExamSuite GetExamsuite(string ExamSuiteId)
        {
            var _examSuite      = repoQ.GetQuestionSuite(ExamSuiteId);
            var _considerations = repoForApprove.ListConsiderationByExamSuiteId(_examSuite?._id);

            //_examSuite.Questions = this.GetQuestion(_examSuite);
            if (_examSuite.Questions != null)
            {
                _examSuite.Questions = this.helper.GetQuestion(_examSuite);
            }

            var examSuite = new ExamSuite
            {
                id          = _examSuite?._id,
                SubjectCode = _examSuite?.SubjectCode,
                SubjectName = _examSuite?.SubjectName,
                TitleCode   = _examSuite?.Code,
                TitleName   = _examSuite?.Title,
                SubjectId   = _examSuite?.SubjectId,
                Questions   = _examSuite?.Questions?.Select(q => new Question
                {
                    id                  = q._id,
                    QuestionNumber      = q.No,
                    IsAllowRandomChoice = q.NoShuffleChoice,
                    Detail              = q.Content,
                    Choices             = q.Choices?.Select(c => new Choice
                    {
                        id        = c.Code,
                        Detail    = c.Content,
                        Voices    = null, // TODO : Add Voice
                        IsCorrect = c.IsCorrectAnswer,
                    }),
                    Considerations = _considerations?.Where(con => con.QuestionNumber == q.No)?.Select(c => new Consideration
                    {
                        id             = c._id,
                        CreateDateTime = c.CreateDateTime,
                        IsAccept       = c.IsAccept,
                        QuestionNumber = c.QuestionNumber,
                        RejectComment  = c.RejectComment,
                        ExamSuiteId    = _examSuite?._id,
                        UserName       = c.UserName,
                    }).ToList(),
                    Voices      = null, // TODO : Add Voice
                    GroupId     = q.GroupId,
                    ExamSuiteId = _examSuite?._id,
                }),
            };

            return(examSuite);
        }
Ejemplo n.º 2
0
        public ExamSuite GetExamsuite(string SubjectId, string ExamSuiteId)
        {
            var _subject = repoForApprove.GetSubject(SubjectId);

            var _examSuite = _subject?.ExamSuites?.FirstOrDefault(es => es._id == ExamSuiteId);

            //listAllQuestion
            var _questions = repoForApprove.ListAllQuestionByQID(_examSuite?.QuestionIds ?? new List <string>(), _examSuite.TitleCode, _subject.ContentLanguage);

            //Move to Repo's job
            //_questions = this.GetQuestion(_questions, ExamSuiteId);

            var examSuite = new ExamSuite
            {
                id          = _examSuite?._id,
                SubjectCode = _subject?.SubjectCode,
                SubjectName = _subject?.SubjectName,
                TitleCode   = _examSuite?.TitleCode,
                TitleName   = _examSuite?.TitleName,
                SubjectId   = _subject?._id,
                Questions   = _questions?.Select(q => new Question
                {
                    id                  = q._id,
                    QuestionNumber      = q.QuestionNumber,
                    IsAllowRandomChoice = q.IsAllowRandomChoice,
                    Detail              = q.Detail,
                    Choices             = q.Choices?.Select(c => new Choice
                    {
                        id        = c._id,
                        Detail    = c.Detail,
                        Voices    = null, // TODO : Add Voice
                        IsCorrect = c.IsCorrect,
                    }),
                    Considerations = null,
                    Voices         = null, // TODO : Add Voice
                    GroupId        = q.GroupId,
                    ExamSuiteId    = _examSuite?._id,
                }),
            };

            return(examSuite);
        }