public async Task <ActionResult> PlayQuiz(Guid quizId)
        {
            Quiz qz = await _quizRepo.GetQuizById(quizId);

            if (qz == null)
            {
                return(StatusCode(404));
            }

            else
            {
                try
                {
                    fullQuiz fq = new fullQuiz()
                    {
                        quizName = qz.Name, quizId = qz.Id
                    };

                    var qstnList = await _questionRepo.GetQuestionsQuiz(fq.quizId);

                    var qstnSelf = qstnList.ToList()[fq.QuestionIndex];

                    var ansListIe = await _answerRepo.GetAnswersForQuestion(qstnSelf.Id);

                    var ansList = ansListIe.ToList();

                    fq.quizQuestion = qstnSelf;
                    fq.answers      = ansList;

                    ViewBag.score = 0;

                    return(View("PlayQuiz", fq));
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }
        public async Task <ActionResult> NextQuestion(string quizName, Guid quizId, int qstnIndex, DateTime date, bool correct, int score)
        {
            try
            {
                var qstnList = await _questionRepo.GetQuestionsQuiz(quizId);

                if (correct)
                {
                    TimeSpan timeDiff = DateTime.Now.Subtract(date);
                    if (timeDiff.TotalSeconds > 30 && timeDiff.TotalSeconds < 0)
                    {
                    }
                    else
                    {
                        if (score >= (qstnList.Count() * 300))
                        {
                            score = 0;
                        }
                        else
                        {
                            int stp1 = 30 - Convert.ToInt32(timeDiff.TotalSeconds);
                            score = score + (stp1 * 10);
                        }
                    }
                }
                else
                {
                }

                fullQuiz fq = new fullQuiz()
                {
                    quizName = quizName, quizId = quizId, QuestionIndex = qstnIndex
                };
                fq.QuestionIndex += 1;

                if (fq.QuestionIndex >= qstnList.Count())
                {
                    // add score to database
                    Scores newscore = new Scores()
                    {
                        AppUserId = _userManager.GetUserId(User),
                        QuizId    = fq.quizId,
                        Date      = DateTime.Now
                    };
                    Quiz qz = await _quizRepo.GetQuizById(fq.quizId);

                    QuizScore qzsc = new QuizScore()
                    {
                        score = newscore, quiz = qz
                    };

                    ViewBag.score = score;

                    return(View("EndQuiz", qzsc));
                }
                else
                {
                    var qstnSelf = qstnList.ToList()[fq.QuestionIndex];

                    var ansListIe = await _answerRepo.GetAnswersForQuestion(qstnSelf.Id);

                    var ansList = ansListIe.ToList();

                    fq.quizQuestion = qstnSelf;
                    fq.answers      = ansList;

                    ViewBag.score = score;

                    return(View("PlayQuiz", fq));
                }
            }
            catch (Exception)
            {
                throw;
            }
        }