Exemplo n.º 1
0
 public SoruController()
 {
     _repoAns     = new RepositoryAnswers("", DbType.SqLite);
     _repoQues    = new RepositoryQuestion("", DbType.SqLite);
     _repoTag     = new RepositoryTag("", DbType.SqLite);
     _repoUser    = new RepositoryUser("", DbType.SqLite);
     _repoIst     = new RepositoryQuestionVisit("", DbType.SqLite);
     _repoQuesTag = new RepositoryQuestionTag("", DbType.SqLite);
 }
Exemplo n.º 2
0
        private void SetQuizList(int Id)
        {
            var QuizId = Repository.FindById(Id);

            Quizes = Quizes.Where(p => p.CatId == Id).ToList();
            foreach (var item in Quizes)
            {
                QuizAnswers = RepositoryAnswers.GetAll().ToList();
                var s = QuizAnswers.Where(p => p.Id == item.Id);
                QuizAnswersList.AddRange(s);
            }
        }
Exemplo n.º 3
0
        public void OnPost(int Id, string answer = "")
        {
            SetCatList();
            Quizes      = Repository.GetAll().ToList();
            QuizAnswers = RepositoryAnswers.GetAll().ToList();

            if (!string.IsNullOrEmpty(answer))
            {
                var Answer = answer.Split(";");
                CatSelectedId = GetCatList(int.Parse(Answer[1]));
                SetQuizList(CatSelectedId);
                if (string.IsNullOrEmpty(AnsweredQuestions))
                {
                    AnsweredQuestions = "";
                }
                if (!AnsweredQuestions.Contains(Answer[0]))
                {
                    foreach (var answerChosen in QuizAnswers)
                    {
                        if (answerChosen.CorrectAns == int.Parse(Answer[0]))
                        {
                            TempData["AnswerCount"] = AnswerCount++;
                            break;
                        }
                    }
                    AnsweredQuestions += Answer[0].ToString() + " ";
                }
            }
            else
            {
                if (Id == 1 || Id == 2)
                {
                    SetQuizList(Id);
                }
                else
                {
                    movieQuizList = Movies.GetAll();
                }
            }
        }
Exemplo n.º 4
0
 public QuestionController()
 {
     _repQues  = new RepositoryQuestion("", DbType.SqLite);
     _repAns   = new RepositoryAnswers("", DbType.SqLite);
     _repQuTag = new RepositoryQuestionTag("", DbType.SqLite);
 }