Exemple #1
0
        public async Task <ActionResult <GeolocationDataResource> > Get(string ipAddress)
        {
            if (!_ipAddressValidator.IsValid(ipAddress))
            {
                return(BadRequest($"Invalid IpAddress format: {ipAddress}."));
            }
            var geolocationData = await _geolocationService.GetAsync(ipAddress);

            if (geolocationData == null)
            {
                return(NotFound($"Not found geolocation data for IpAddress {ipAddress}"));
            }
            return(Ok(_geolocationDataConverter.Convert(geolocationData)));
        }