public override bool IsValid(object value) { if (value == null) { return(false); } return(TurkishIdNumber.IsValid(value.ToString())); }
/// <inheritdoc/> protected override ValidationResult IsValid(object value, ValidationContext validationContext) { // It's impossible to call this method with a null value // because ValidationContext throws ArgumentNullException on null instance values. if (value is null) { throw new ArgumentNullException(nameof(value)); } return(TurkishIdNumber.IsValid(value.ToString()) ? ValidationResult.Success : new ValidationResult(ErrorMessage)); }
public override bool IsValid(object value) { return(TurkishIdNumber.IsValid(value?.ToString())); }