コード例 #1
0
        public ActionResult ValidationFormTypeMapping_Update([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")] IEnumerable <ValidationFormTypeMappingViewModel> validationFormTypeMappings)
        {
            if (validationFormTypeMappings != null && ModelState.IsValid)
            {
                try
                {
                    ValidationMetadataService validationMetadataService = new ValidationMetadataService(new ParametersContext());

                    foreach (var validationFormTypeMapping in validationFormTypeMappings)
                    {
                        validationMetadataService.ValidationFormTypeMapping_Update(validationFormTypeMapping);
                    }
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("", ex.InnerException.ToString());
                }
            }

            return(Json(validationFormTypeMappings.ToDataSourceResult(request, ModelState)));
        }
コード例 #2
0
        public ActionResult ValidationRule_Destroy([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")] IEnumerable <ValidationRuleViewModel> validationRules)
        {
            if (validationRules.Any())
            {
                try
                {
                    ValidationMetadataService validationMetadataService = new ValidationMetadataService(new ParametersContext());

                    foreach (var validationRule in validationRules)
                    {
                        validationMetadataService.ValidationRule_Destroy(validationRule);
                    }
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("", ex.InnerException.ToString());
                }
            }

            return(Json(validationRules.ToDataSourceResult(request, ModelState)));
        }
コード例 #3
0
        public ActionResult ValidationTableColumnDef_Create([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")] IEnumerable <ValidationTableColumnDefViewModel> valTableColumnDefs)
        {
            var results = new List <ValidationTableColumnDefViewModel>();

            if (valTableColumnDefs != null && ModelState.IsValid)
            {
                try
                {
                    ValidationMetadataService validationMetadataService = new ValidationMetadataService(new ParametersContext());

                    foreach (var valTableColumnDef in valTableColumnDefs)
                    {
                        validationMetadataService.ValidationTableColumnDef_Create(valTableColumnDef);
                        results.Add(valTableColumnDef);
                    }
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("", ex.InnerException.ToString());
                }
            }

            return(Json(results.ToDataSourceResult(request, ModelState)));
        }
コード例 #4
0
        public ActionResult ValidationRule_Read([DataSourceRequest] DataSourceRequest request)
        {
            ValidationMetadataService validationMetadataService = new ValidationMetadataService(new ParametersContext());

            return(Json(validationMetadataService.ValidationRule_Read().ToDataSourceResult(request)));
        }