// GET: Answer public IActionResult Index() { var answer = _answerRepo.ListAll(); return(View(_answerRepo.ListAll())); /* * AnswerModel model = new List<AnswerModel>(); * _answerRepo.ListAll() * .ToList() * .ForEach(a => * { * AnswerModel answer = new AnswerModel * { * Id = a.Id * Content = a.content * IsCorrect = a.isCorrect * * }; * model.Add() * }); */ }
public async Task <IActionResult> GetQuizzes() { var quizzes = await _dbContext.Quizzes .Include(q => q.Questions) .ThenInclude(a => a.Answers) .ToListAsync(); try { return(Ok(_quizRepo.ListAll())); } catch (Exception ex) { _logger.LogError($"Failed to find a quiz: {ex}"); return(BadRequest("Failed to find a quiz")); } }
// GET: Quiz public IActionResult Index() { var quiz = _quizRepo.ListAll(); return(View(_quizRepo.ListAll())); }
// GET: Question public ActionResult Index() { var question = _questionRepo.ListAll(); return(View(_questionRepo.ListAll())); }