/// <summary> /// Determines an IP address maps to a given list of countries. /// </summary> /// <returns>True or False whether the IPv4 Address is from a whitelisted country.</returns> public bool?IsIsoWhitelisted(GeoIpRequest geoIpRequest) { Country countryMapping = _geoIpRepository.GetCountryMapping(geoIpRequest.IpAddress); if (countryMapping != null) { return(geoIpRequest.WhitelistedCountries.Contains(countryMapping.IsoCode)); } return(false); }
public IActionResult Post([FromBody] GeoIpRequest geoIpRequest) { return(Ok(_geoIpService.IsIsoWhitelisted(geoIpRequest))); }