Ejemplo n.º 1
0
        public ActionResult Thanks(QuestionModel model)
        {
            CookieService cookie=new CookieService();
            Alternative alternative = _db.Alternatives.Single(a => a.Id == model.AlternativeId);
            Question question = _db.Questions.Single(q => q.Id == model.QuestionId);

            if (cookie.VoteAllowed(question.Id))
            {
                alternative.Votes++;
                _db.SaveChanges();
                cookie.MakeVoteAuthenticate(question.Id);

                return View(question);
            }
            else return View("VoteDenied",question);
        }