示例#1
0
        public virtual ActionResult LOT(LOTViewModel model)
        {
            if (ModelState.IsValid)
            {
                var questionIdValue = model.Questions
                                      .ToDictionary(key => key.Id, val => val.Value.Value);

                var results = (List <Result>)Session[_resultsSessionKey];
                if (results == null)
                {
                    return(RedirectToAction(MVC.Application.Survey.IntervieweeInfo()));
                }

                results.RemoveAll(x => x.QuestionnaireId == model.QuestionnaireId);
                results.AddRange(_resultsRepository.GetResultsByDict(model.QuestionnaireId, questionIdValue));
                Session[_resultsSessionKey] = results;

                return(RedirectToAction(MVC.Application.Survey.IZZ()));
            }
            else
            {
                model.ErrorProperties = ModelState
                                        .Where(x => x.Value.Errors.Count > 0)
                                        .Select(x => x.Key)
                                        .ToArray();

                return(View(model));
            }
        }
示例#2
0
        public virtual ActionResult LOT()
        {
            var lot   = _questionnairesRepository.GetByType(KeyType.LOTR);
            var model = new LOTViewModel(lot);

            return(View(model));
        }