Exemple #1
0
        public void ValidateModel(TModel model)
        {
            RulesException.ErrorsForValidationResults(ValidateModelProperties(model));
            ValidateModelRules(model);

            RulesException.ThrowException();
        }
Exemple #2
0
        public void ValidateModel(TModel model)
        {
            ValidateModelPropertiesAndBuildRulesException(model);
            ValidateModelRules(model);

            RulesException.ThrowException();
        }
Exemple #3
0
        public async Task ValidateModelAsync(TModel model)
        {
            ValidateModelPropertiesAndBuildRulesException(model);
            await ValidateModelRulesAsync(model);

            RulesException.ThrowException();
        }
Exemple #4
0
        public async Task ValidateModelAsync(TModel model)
        {
            RulesException.ErrorsForValidationResults(ValidateModelProperties(model));
            await ValidateModelRulesAsync(model);

            RulesException.ThrowException();
        }
Exemple #5
0
            public void Validate(RulesBaseParams parameters)
            {
                ValidateModelPropertiesAndBuildRulesException(this);

                if (string.IsNullOrEmpty(Foo))
                {
                    RulesException.ErrorFor(x => x.Foo, "Please supply a Foo");
                }

                if (parameters.ThrowException)
                {
                    RulesException.ThrowException();
                }
            }