Beispiel #1
0
        private ActionResult RenderStep <T>(IRuleQuestion <T> question, int currentStepNumber)
        {
            if (currentStepNumber != CurrentStepNumber)
            {
                return(RedirectToAction("Step" + CurrentStepNumber));
            }

            ViewData["StepName"] = "Step " + CurrentStepNumber;
            return(View("CheckRule", question));
        }
Beispiel #2
0
        private void RecordAnswer <T>(IRuleQuestion <T> question)
        {
            var answer = new RuleAnswer()
            {
                Question        = question.Question,
                Answer          = question.ToString(),
                IsEligible      = question.IsValid,
                SessionID       = System.Web.HttpContext.Current.Session.SessionID,
                UserHostAddress = System.Web.HttpContext.Current.Request.UserHostAddress
            };

            Container.AddToRuleAnswers(answer);
            Container.SaveChanges();
        }
Beispiel #3
0
        private ActionResult ExecuteStep <T>(IRuleQuestion <T> question, int currentStep, object routeValues = null)
        {
            if (currentStep != CurrentStepNumber)
            {
                return(RedirectToAction("Step" + CurrentStepNumber));
            }

            RecordAnswer(question);

            if (!ModelState.IsValid)
            {
                return(View("CheckRule", question));
            }

            if (IsValid(question))
            {
                CurrentStepNumber++;
                return(RedirectToAction("Step" + CurrentStepNumber, routeValues));
            }

            CurrentStepNumber = 1;
            return(View("NotEligible"));
        }
Beispiel #4
0
 private static bool IsValid <T>(IRuleQuestion <T> question)
 {
     return(question.IsValid);
 }