Esempio n. 1
0
        public virtual ActionResult EvaluateModule(ReportViewModel model, int moduleId)
        {
            if (model == null || model.Modules == null)
            {
                model = new ReportViewModel();
                model.ErrorMessage = Localization.GetText(Literals.QUESTIONNAIRE_ERROR_LOAD_REQUEST);
                return(new HttpStatusCodeResult(HttpStatusCode.NoContent, model.ErrorMessage));
            }

            var resultResponse = _assessmentService.Evaluate(new AssessmentRequest()
            {
                ModuleId        = moduleId,
                QuestionnaireId = model.QuestionnaireId
            });

            if (!resultResponse.IsValid)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NoContent, resultResponse.ErrorMessage));
            }

            var module = model.Modules.FirstOrDefault(m => m.ModuleId == moduleId);

            if (module != null)
            {
                module.Assessments   = resultResponse.Assessments;
                model.IsAllEvaluated = resultResponse.IsAllEvaluated;
            }

            model.SelectedAssessment = new MoveAssessmentViewModel()
            {
                AssessmentId = default(int),
                ModuleId     = moduleId
            };

            return(PartialView("~/Areas/PACI/Views/Controls/ReportAssessmentTable.cshtml", model));
        }