Exemplo n.º 1
0
 public void PostQuestionsToDatabase()
 {
     foreach (Question q in Questions)
     {
         _context.Questions.Add(q);
     }
     _context.SaveChanges();
 }
Exemplo n.º 2
0
        public void SaveResultsToDb()
        {
            int round          = Convert.ToInt32(Request.Query["round"]);
            int answerOneTotal = Convert.ToInt32(Request.Form["answerOneFormCounter"]);
            int answerTwoTotal = Convert.ToInt32(Request.Form["answerTwoFormCounter"]);
            var question       = _context.Questions.Find(round);

            question.VoteOneTotal = answerOneTotal;
            question.VoteTwoTotal = answerTwoTotal;

            _context.SaveChanges();
        }
Exemplo n.º 3
0
        // Adds couple vote to db, checks question and which couple is voting
        public void AddCoupleVotesToDb()
        {
            TheQuestion = WhichQuestionToUse();
            String CoupleAnswer = Request.Form["CoupleAnswer"];

            if (IsCoupleOne())
            {
                TheQuestion.CoupleOneVote = CoupleAnswer;
            }

            else
            {
                TheQuestion.CoupleTwoVote = CoupleAnswer;
            }
            _context.SaveChanges();
        }
Exemplo n.º 4
0
        public void SaveCoupleNameToDb()
        {
            string coupleName = Request.Form["username"];

            if (TheGame.coupleOneName == "pending")
            {
                TheGame.coupleOneName = coupleName;
            }
            else if (TheGame.coupleTwoName == "pending")
            {
                TheGame.coupleTwoName = coupleName;
            }
            else
            {
                Console.WriteLine("Table full, truncate it!");
            }
            _context.SaveChanges();
        }