Пример #1
0
        // 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()
             * });
             */
        }
Пример #2
0
        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"));
            }
        }
Пример #3
0
        // GET: Quiz
        public IActionResult Index()
        {
            var quiz = _quizRepo.ListAll();

            return(View(_quizRepo.ListAll()));
        }
Пример #4
0
        // GET: Question
        public ActionResult Index()
        {
            var question = _questionRepo.ListAll();

            return(View(_questionRepo.ListAll()));
        }