public static Validation IsDecimal(this Validation validate, string value, string property) { var regex = new Regex("^[+-]?\\d*(\\.\\d*)?$"); return(validate .IsNotEmpty(value, $"{property} is empty") .ContinueIfValid(v1 => v1.IsTrue(regex.IsMatch(value), $"{property} is not a decimal"))); }
public static Validation IsInteger(this Validation validate, string value, string property) { var regex = new Regex("^([+-]?[1-9]\\d*|0)$"); return(validate .IsNotEmpty(value, $"{property} is empty") .ContinueIfValid(v => v.IsTrue(regex.IsMatch(value), $"{property} is not an integer"))); }