Beispiel #1
0
 public async Task <IActionResult> GetQuizQuestions(Guid?id)
 {
     if (id == null)
     {
         return(BadRequest("This enpoind requires a valid QuizId"));
     }
     return(Ok(await quizRepo.GetQuizQuestionsAsync(id ?? Guid.Empty)));
 }
Beispiel #2
0
        public async Task <ActionResult> Index()
        {
            var quizzes = await quizRepo.GetAllQuizzesAsync();

            List <QuizClass> valids = new List <QuizClass>();

            foreach (QuizClass quiz in quizzes)
            {
                var questions = await quizRepo.GetQuizQuestionsAsync(quiz.QuizId);

                if (questions.Count() != 0)
                {
                    valids.Add(quiz);
                }
            }
            return(View(valids.AsEnumerable()));
        }
        public async Task <ActionResult> Questions(Guid?id)
        {
            if (id == null)
            {
                return(Redirect("/Error/400"));
            }
            //controleren of de quiz we lbestaat
            QuizClass quiz = await quizRepo.GetQuizByIdAsync(id ?? Guid.Empty);

            if (quiz == null)
            {
                return(Redirect("/Error/0"));
            }
            var result = await quizRepo.GetQuizQuestionsAsync(id ?? Guid.Empty);

            ViewBag.quizId = id;
            return(View(result));
        }