コード例 #1
0
        public async Task <QuestionVideoModel> GetInfoExamTest(int videoLineId)
        {
            var examStructure = await _examStructureRepository.GetSingleByConditionAsync(n => n.VideoLineId == videoLineId);

            if (examStructure != null)
            {
                var questionIds = examStructure.QuestionLineId.Split(";").ToList();
                var exam        = new Test_Exam()
                {
                    ExamId       = Guid.NewGuid(),
                    ExamName     = "User 1 test",
                    TotalScore   = 0,
                    QtyCorrect   = 0,
                    QtyIncorrect = 0
                };
                var result = await _questionRepository
                             .ListAsync(null, null,
                                        z => z.Include(i => i.QuestionDetails)
                                        .Include(i => i.ExamQuestionDetails)
                                        //.Include(i => i.AppUser)
                                        );

                var questions = (from question in result
                                 where questionIds.Contains(question.LineId.ToString())
                                 select question
                                 ).OrderBy(n => n.Order).ToList();
                QuestionVideoModel questionVideo = new QuestionVideoModel()
                {
                    Exam = exam,
                    //ExamStructure = examStructure,
                    Questions = questions
                };
                return(questionVideo);
            }
            return(new QuestionVideoModel());
        }
コード例 #2
0
 public async Task <Test_ExamStructure> GetSingleByConditionAsync(Expression <Func <Test_ExamStructure, bool> > filter, Func <IQueryable <Test_ExamStructure>, IIncludableQueryable <Test_ExamStructure, object> > includeProperties = null)
 {
     return(await _examStructureRepository.GetSingleByConditionAsync(filter, includeProperties));
 }