public ActionResult AddQuestion(Question q)
        {
            //
            //db.Question.Insert(q);
            //add q to db
            var query =
                from question in db.Question
                select new
                {
                    Content = question.Content,
                    Answer1 = question.Answer1,
                    Answer2 = question.Answer2,
                    Answer3 = question.Answer3,
                    Answer4 = question.Answer4,
                    CorrectAnswer = question.CorrectAnswer
                };
            query.ToList();

            List<Question> qList = new List<Question>();

            //db.Question.Insert(new Question
            //{
            //	Id = query.Count() + 1,
            //	Content = q.Content,
            //	Answer = q.Answer
            //});

            q.Id = query.Count() + 1;
            db.Question.Insert(q);

            foreach (var x in query) //How is the new question making it into this query??
            {
                qList.Add(new Question
                {
                    //    Id = x.Id,
                    Content = x.Content,
                    Answer1 = x.Answer1,
                    Answer2 = x.Answer2,
                    Answer3 = x.Answer3,
                    Answer4 = x.Answer4,
                    CorrectAnswer = x.CorrectAnswer
                });
            }

            return View("AddQuestionAndQuestionList", qList);
        }
        public ActionResult Game(string questionId, Player play, Question quest, string userAnswer)
        {
            ModelState.Clear();
            //CheckPlayerAnswer(p)
            int pId = 0;
            int qId = 0;

            try
            {
                //	pId = Int32.Parse(play.PlayerId);
                pId = play.PlayerId;
                qId = Int32.Parse(questionId);
            }
            catch (FormatException e)
            {
                Console.WriteLine(e.Message);
            }
            var query =
                from question in db.Question
                select new
                {
                    Content = question.Content,
                    Answer1 = question.Answer1,
                    Answer2 = question.Answer2,
                    Answer3 = question.Answer3,
                    Answer4 = question.Answer4,
                    CorrectAnswer = question.CorrectAnswer,
                    Id = question.Id
                };
            query.ToList();

            List<Question> qList = new List<Question>();
            foreach (var x in query)
            {
                qList.Add(new Question
                {
                    Content = x.Content,
                    Answer1 = x.Answer1,
                    Answer2 = x.Answer2,
                    Answer3 = x.Answer3,
                    Answer4 = x.Answer4,
                    CorrectAnswer = x.CorrectAnswer,
                    Id = x.Id
                });
            }

            var p = new Player();
            var count =CheckPlayerAnswer(qList[qId - 1], userAnswer);
            p.Score += count;
            ViewBag.CorrectInt = p.Score;
            //int pId = 0;
            //int qId = 0;

            //try
            //{
            ////	pId = Int32.Parse(play.PlayerId);
            //    pId = play.PlayerId;
            //    qId = Int32.Parse(questionId);
            //}
            //catch (FormatException e)
            //{
            //    Console.WriteLine(e.Message);
            //}

            p.PlayerId = pId;
            p.Question = (qId == qList.Count()) ? qList[0] : qList[qId];

            return View(p);
        }
 public int CheckPlayerAnswer(Question q, string playerAnswer)
 {
     var s = 0;
     bool gotCorrect = false;
     if (playerAnswer.Equals(q.CorrectAnswer))
     {
         s++;
     }
     return s;
 }