示例#1
0
        public async Task <Exam> GetExamwithQuestionsWithAnswers(int id)
        {
            var exam = await ExamRepo.GetAsync(id);

            var questions = await QuestionRepo.FindBy(a => a.ExamId == id).ToListAsync();

            foreach (var q in questions)
            {
                q.Answers = await AnswersRepo.FindBy(a => a.QuestionId == q.Id).ToListAsync();
            }
            return(exam);
        }