public IActionResult Take(int id, TakeSurveyViewModel model)
        {
            if (ModelState.IsValid)
            {
                string UserID      = _userManager.GetUserId(User);
                var    this_User   = _userService.GetById(UserID);
                var    this_survey = _surveyService.GetSurveyById(id);

                if (model.QResponseList.Count > 0)
                {
                    foreach (var obj in model.QResponseList)
                    {
                        Response res = new Response();

                        res.ParentQuestion   = _surveyService.GetSurveyQuestionById(obj.QuestionId);
                        res.SurveyTaker      = this_User;
                        res.QuestionResponse = (ResponseValues)obj.value;

                        _surveyService.AddSurveyQuestionResponse(res);
                    }
                }
                else
                {
                    return(Content("Count: " + model.ToString()));
                }
                _surveyService.BumpSurveyTakenCount(this_survey.Id);
                return(RedirectToAction("Index", "Home"));
            }

            return(Content(ModelState.Values.ToString()));
        }
        public IActionResult Take(int id)
        {
            string UserID = _userManager.GetUserId(User);

            if (_surveyService.UserTookSurvey(id, UserID))
            {
                return(View("~/Views/Survey/_SurveyTaken.cshtml"));
            }
            else
            {
                TakeSurveyViewModel model = new TakeSurveyViewModel();

                var this_Survey   = _surveyService.GetSurveyById(id);
                var questionsList = _surveyService.GetSurveyQuestions(this_Survey.Id);

                List <QResponses> qResponses = new List <QResponses>();
                foreach (var q in questionsList)
                {
                    QResponses r = new QResponses();
                    r.QuestionId    = q.Id;
                    r.QuestionValue = q.Question;
                    qResponses.Add(r);
                }

                model.QResponseList = qResponses;
                return(View(model));
            }
        }