public static ValidationResult ValidateCountryOrRegion(AirportDetails airportDetails, ValidationContext validationContex) { return(airportDetails.CountryOrRegionCode == "ZZ" && airportDetails.CityCode != "XXX" ? new ValidationResult(string.Format("City '{0}' is not located in country or region 'ZZ'.", airportDetails.CityCode)) : ValidationResult.Success); }
public static ValidationResult ValidateCountry(AirportDetails airportDetails, ValidationContext validationContex) { return airportDetails.CountryCode == "ZZ" && airportDetails.CityCode != "XXX" ? new ValidationResult(string.Format("City '{0}' is not located in country 'ZZ'.", airportDetails.CityCode)) : ValidationResult.Success; }