예제 #1
0
        protected override void ValidateFields(List <IFieldValidationResult> validationResults)
        {
            if (IsRedirect && RedirectType == null)
            {
                validationResults.Add(FieldValidationResult.CreateError(nameof(RedirectType),
                                                                        "You need to specify a type to redirect to"));
            }

            if (IsIgnored && IsRedirect)
            {
                validationResults.Add(FieldValidationResult.CreateError(nameof(RedirectType),
                                                                        "You cannot ignore and redirect a type at the same time"));
            }

            if (_typesService.HasType(Type))
            {
                validationResults.Add(FieldValidationResult.CreateError(nameof(TypeName),
                                                                        "Another type with the same name already exists"));

                validationResults.Add(FieldValidationResult.CreateError(nameof(SubTypeName),
                                                                        "Another type with the same name already exists"));
            }

            base.ValidateFields(validationResults);
        }