Exemplo n.º 1
0
        private bool Validate(Options options, ViewModel viewModel)
        {
            var controller        = new OptionsController();
            var validationResults = controller.DoValidation(options);

            var validationHelper = new ValidationModelHelper();

            validationHelper.ApplyValidationResults(validationResults, viewModel);

            return(!validationResults.HasErrors);
        }
Exemplo n.º 2
0
        private bool Validate(Options options, ViewModel viewModel)
        {
            var validator         = new OptionsValidator();
            var validationResults = validator.Validate(options);

            var validationHelper = new ValidationModelHelper(r => {
                object model       = viewModel;
                var injectSettings = r.Record as InjectSettings;
                if (injectSettings != null)
                {
                    model = viewModel.InjectSettings.FirstOrDefault(i => String.Equals(i.File, injectSettings.File));
                }
                return(model);
            });

            validationHelper.ApplyValidationResults(validationResults, viewModel);

            return(!validationResults.HasErrors);
        }
Exemplo n.º 3
0
 public void ShowValidationResults(ValidationResults results)
 {
     _ValidationHelper.ApplyValidationResults(results, _ViewModel);
     _FailedValidation = results.HasErrors;
 }