Esempio n. 1
0
        // FRONTEND
        public ActionResult Question(int questionId)
        {
            //check if user is answered the poll
            var ip           = Request.UserHostAddress;
            var userAnswered = _pollRepository.CheckUserAnswered(questionId, ip);

            if (userAnswered)
            {
                return(Result(questionId));
            }
            else
            {
                var now      = DateTime.Now;
                var question = _pollRepository.Find(questionId);
                if (!question.Done && question.FromDate <= now && (question.EndDate == null || question.EndDate >= now))
                {
                    return(PartialView("_Question", question));
                }
                else
                {
                    return(Result(questionId));
                }
            }
        }