Esempio n. 1
0
        public override void Validate(string fieldName, ContentFieldOptions options, ValidationContext context)
        {
            DateFieldOptions fieldOptions = (DateFieldOptions)options;

            if (fieldOptions.IsRequired && HasValue == false)
            {
                context.AddRequireValidation(fieldName);
            }
        }
        public static TContentSchema AddDate <TContentSchema>(this TContentSchema schema, string name, Action <DateFieldOptions>?configOptions = null)
            where TContentSchema : IContentSchema
        {
            DateFieldOptions options = new DateFieldOptions();

            configOptions?.Invoke(options);

            schema.AddField <DateField>(name, options, null);

            return(schema);
        }