示例#1
0
        public async Task <IActionResult> GetQuizzes()
        {
            var quizzes = await _dbContext.Quizzes
                          .Include(q => q.Questions)
                          .ThenInclude(a => a.Answers)
                          .ToListAsync();

            try
            {
                return(Ok(_quizRepo.ListAllQuizzes()));
            }
            catch (Exception ex)
            {
                _logger.LogError($"Failed to find quiz: {ex}");
                return(BadRequest("Failed to get quiz"));
            }
        }
示例#2
0
        // GET: Quiz
        public IActionResult Index()
        {
            var quiz = _quizRepo.ListAllQuizzes();

            return(View(_quizRepo.ListAllQuizzes()));
        }