Exemple #1
0
        private ResponseBase ValidatorModel(WorkflowSaveViewModel model)
        {
            var response = new ResponseBase {
                IsValid = true
            };

            if (model.ValidatorViewModel != null && model.WorkflowInstanceId != 0)
            {
                var responseDeleteValidators =
                    _validatorService.DeleteValidators(model.ValidatorViewModel, model.WorkflowInstanceId);

                if (!responseDeleteValidators.IsValid)
                {
                    response.IsValid      = false;
                    response.ErrorMessage = responseDeleteValidators.ErrorMessage;

                    return(response);
                }
            }

            if (model.AdditionalValidators != null && model.WorkflowInstanceId != 0)
            {
                var workflowInstance = _workflowInstanceTaskRepository
                                       .GetOne(wit => wit.WorkflowInstanceId == model.WorkflowInstanceId);

                var responseCreateValidators =
                    _validatorService.AdditionalValidators(model.WorkflowInstanceId,
                                                           workflowInstance.WorkflowTaskType.WorkflowTaskTypeId,
                                                           model.AdditionalValidators);

                if (!responseCreateValidators.IsValid)
                {
                    response.IsValid      = false;
                    response.ErrorMessage = responseCreateValidators.ErrorMessage;

                    return(response);
                }
            }

            return(response);
        }