public ActionResult Start()
        {
            DateStart = DateTime.Now;
            bool        Quizz;
            int         userID            = Convert.ToInt32(Session["userId"]);
            var         quizzresults      = model.QuizzResults;
            QuizzResult queryQuizzresults = null;

            var Query = from result in quizzresults
                        where result.UserID == userID && result.Theme == "serie"
                        select result;

            foreach (var item in Query)
            {
                queryQuizzresults = item;
            }

            if (queryQuizzresults == null)
            {
                ViewBag.ID    = 1;
                Quizz         = true;
                ViewBag.Quizz = Quizz;
            }
            else
            {
                Quizz         = false;
                ViewBag.Quizz = Quizz;
            }
            return(View("QuizzSerie"));
        }
        public ActionResult Question3(string answer3)
        {
            bool     Quizz    = true;
            TimeSpan timeDiff = DateTime.Now - DateStart;
            double   time     = timeDiff.TotalSeconds;

            int  userID = Convert.ToInt32(Session["userId"]);
            var  users  = model.Users;
            int  score  = 0;
            User user   = users.Find(userID);

            ViewBag.Quizz = Quizz;
            if (Quizz)
            {
                ViewBag.ID = 4;
                try
                {
                    userAnswers.Add("Question3", answer3);
                }
                catch (Exception)
                {
                    userAnswers.Remove("Question3");
                    userAnswers.Add("Question3", answer3);
                }
                Quizz = false;
            }

            Dictionary <string, string> goodAnswers = new Dictionary <string, string>()
            {
                { "Question1", "Il a été accusé d'avoir ouvert la Chambre des Secrets" },
                { "Question2", "Miss Teigne" }, { "Question3", "Remus, Sirius, Peter et James" }
            };

            foreach (var key in userAnswers.Keys)
            {
                if (userAnswers[key].Equals(goodAnswers[key]))
                {
                    score++;
                }
            }

            ViewBag.score = score;

            QuizzResult quizz = new QuizzResult();

            quizz.UserID    = userID;
            quizz.Score     = score;
            quizz.Theme     = "film";
            quizz.UserLogin = user.Login;
            quizz.Time      = time;
            model.QuizzResults.Add(quizz);
            model.SaveChanges();
            userAnswers.Clear();
            ViewBag.time = time;
            return(View("QuizzFilm"));
        }
        public ActionResult Question3(string answer3)
        {
            bool     Quizz    = true;
            int      userID   = Convert.ToInt32(Session["userId"]);
            var      users    = model.Users;
            int      score    = 0;
            TimeSpan timeDiff = DateTime.Now - DateStart;
            double   time     = timeDiff.TotalSeconds;
            User     user     = users.Find(userID);

            ViewBag.Quizz = Quizz;
            if (Quizz)
            {
                ViewBag.ID = 4;
                try
                {
                    userAnswers.Add("Question3", answer3);
                }
                catch (Exception)
                {
                    userAnswers.Remove("Question3");
                    userAnswers.Add("Question3", answer3);
                }
                Quizz = false;
            }

            Dictionary <string, string> goodAnswers = new Dictionary <string, string>()
            {
                { "Question1", "8 août 1988" }, { "Question2", "Mickael" }, { "Question3", "Lito" }
            };

            foreach (var key in userAnswers.Keys)
            {
                if (userAnswers[key].Equals(goodAnswers[key]))
                {
                    score++;
                }
            }

            ViewBag.score = score;

            QuizzResult quizz = new QuizzResult();

            quizz.UserID    = userID;
            quizz.Score     = score;
            quizz.Theme     = "serie";
            quizz.UserLogin = user.Login;
            quizz.Time      = time;
            model.QuizzResults.Add(quizz);
            model.SaveChanges();
            userAnswers.Clear();
            ViewBag.time = time;
            return(View("QuizzSerie"));
        }