NuSurvey.Web.Controllers.SurveyResponseController.AnswerNext C# (CSharp) Method

AnswerNext() public method

#5 Load the next available question, or finalize if all questions are answered. GET: /SurveyResponse/AnswerNext/5
public AnswerNext ( int id, System.Guid publicGuid ) : System.Web.Mvc.ActionResult
id int SurveyResponse Id
publicGuid System.Guid
return System.Web.Mvc.ActionResult
        public ActionResult AnswerNext(int id, Guid? publicGuid)
        {
            var surveyResponse = _surveyResponseRepository.GetNullableById(id);
            if (string.IsNullOrWhiteSpace(CurrentUser.Identity.Name))
            {
                surveyResponse = (SurveyResponse)Session[publicGuid.ToString()];
            }

            if (surveyResponse == null || !surveyResponse.IsPending)
            {
                Message = "Pending survey not found";
                return this.RedirectToAction<ErrorController>(a => a.Index());
            }
            if (!string.IsNullOrWhiteSpace(CurrentUser.Identity.Name))
            {
                if (surveyResponse.UserId.ToLower() != CurrentUser.Identity.Name.ToLower())
                {
                    Message = "Not your survey";
                    return this.RedirectToAction<ErrorController>(a => a.NotAuthorized());
                }
            }
            else
            {
                if (surveyResponse.UserId.ToLower() != publicGuid.ToString().ToLower())
                {
                    Message = "Not your survey";
                    return this.RedirectToAction<ErrorController>(a => a.NotAuthorized());
                }
            }
            var viewModel = SingleAnswerSurveyResponseViewModel.Create(Repository, surveyResponse.Survey, surveyResponse);
            viewModel.PublicGuid = publicGuid;

            if (viewModel.CurrentQuestion == null)
            {
                return this.RedirectToAction(a => a.FinalizePending(surveyResponse.Id, publicGuid));
            }

            ViewBag.surveyimage = string.Format("{0}-survey", surveyResponse.Survey.ShortName.ToLower().Trim());
            return View(viewModel);
        }

Same methods

SurveyResponseController::AnswerNext ( int id, QuestionAnswerParameter questions, string byPassAnswer, System.Guid publicGuid ) : System.Web.Mvc.ActionResult