private PartialViewResult ViewEditProjectEvaluation(EditProjectEvaluationViewModel viewModel, ProjectEvaluation projectEvaluation)
        {
            var evaluationCriteriaSimples = projectEvaluation.Evaluation.EvaluationCriterias.Select(x => new EvaluationCriteriaSimple(x)).ToList();
            var viewData = new EditProjectEvaluationViewData(projectEvaluation, evaluationCriteriaSimples);

            return(RazorPartialView <EditProjectEvaluation, EditProjectEvaluationViewData, EditProjectEvaluationViewModel>(viewData, viewModel));
        }
        public PartialViewResult EditProjectEvaluation(ProjectEvaluationPrimaryKey projectEvaluationPrimaryKey)
        {
            var projectEvaluation = projectEvaluationPrimaryKey.EntityObject;

            if (projectEvaluation.Evaluation.EvaluationStatusID == (int)EvaluationStatusEnum.InProgress)
            {
                var viewModel = new EditProjectEvaluationViewModel(projectEvaluation);
                return(ViewEditProjectEvaluation(viewModel, projectEvaluation));
            }
            else
            {
                var confirmMessage = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()} can only be evaluated when the {FieldDefinitionEnum.EvaluationStatus.ToType().GetFieldDefinitionLabel()} is {EvaluationStatus.InProgress.EvaluationStatusDisplayName}";

                var viewData  = new ConfirmDialogFormViewData(confirmMessage, false);
                var viewModel = new ConfirmDialogFormViewModel(projectEvaluation.ProjectEvaluationID);
                return(RazorPartialView <ConfirmDialogForm, ConfirmDialogFormViewData, ConfirmDialogFormViewModel>(viewData, viewModel));
            }
        }
        public ActionResult EditProjectEvaluation(ProjectEvaluationPrimaryKey projectEvaluationPrimaryKey, EditProjectEvaluationViewModel viewModel)
        {
            var projectEvaluation = projectEvaluationPrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewEditProjectEvaluation(viewModel, projectEvaluation));
            }


            viewModel.UpdateModel(CurrentFirmaSession, projectEvaluation);

            SetMessageForDisplay($"Successfully updated the {FieldDefinitionEnum.ProjectEvaluation.ToType().GetFieldDefinitionLabel()} for {projectEvaluation.Project.GetDisplayName()}.");

            return(new ModalDialogFormJsonResult());
        }