/// <inheritdoc/> public void Validate(string errorLocaction, string propertyPath = "") { FulcrumValidate.IsNotNullOrWhiteSpace(Id, nameof(Id), errorLocaction); FulcrumValidate.IsNotNullOrWhiteSpace(Name, nameof(Name), errorLocaction); FulcrumValidate.MatchesRegExp("^[a-zA-Z]+$", Name, nameof(Name), errorLocaction); FulcrumValidate.IsNotNullOrWhiteSpace(Category, nameof(Category), errorLocaction); FulcrumValidate.MatchesRegExp("^[a-zA-Z]+$", Category, nameof(Category), errorLocaction); FulcrumValidate.IsGreaterThanOrEqualTo(0.0, Price, nameof(Price), errorLocaction); FulcrumValidate.IsNotDefaultValue(DateAdded, nameof(DateAdded), errorLocaction); FulcrumValidate.IsLessThanOrEqualTo(DateTimeOffset.Now, DateAdded, nameof(DateAdded), errorLocaction); }
/// <inheritdoc/> public override void Validate(string errorLocaction, string propertyPath = "") { FulcrumValidate.IsGreaterThan(0, Id, nameof(Id), errorLocaction); FulcrumValidate.IsNotNullOrWhiteSpace(Name, nameof(Name), errorLocaction); FulcrumValidate.IsTrue(Regex.IsMatch(Name, "^[a-zA-Z]+$"), errorLocaction, $"Property {nameof(Name)} must only consist of upper or lower case a-z."); FulcrumValidate.IsNotNullOrWhiteSpace(Category, nameof(Category), errorLocaction); FulcrumValidate.IsTrue(Regex.IsMatch(Category, "^[a-zA-Z]+$"), errorLocaction, $"Property {nameof(Category)} must only consist of upper or lower case a-z."); FulcrumValidate.IsGreaterThanOrEqualTo(0.0, Price, nameof(Price), errorLocaction); FulcrumValidate.IsNotDefaultValue(DateAdded, nameof(DateAdded), errorLocaction); FulcrumValidate.IsLessThanOrEqualTo(DateTimeOffset.Now, DateAdded, nameof(DateAdded), errorLocaction); }
/// <inheritdoc /> public void Validate(string errorLocation, string propertyPath = "") { if (Type != null) { FulcrumValidate.IsTrue(Type == "private" || Type == "public", null, $"{nameof(Type)} must have one of the values \"private\" and \"public\"."); } FulcrumValidate.IsGreaterThanOrEqualTo(0, Created, nameof(Created), errorLocation); var now = DateTimeOffset.Now; if (StartInclusive != null) { FulcrumValidate.IsLessThanOrEqualTo(now, StartInclusive.Value, nameof(StartInclusive), errorLocation); } if (EndExlusive != null) { FulcrumValidate.IsLessThanOrEqualTo(now, EndExlusive.Value, nameof(EndExlusive), errorLocation); } }