public string GetLocation(string ip) { IPGeolocationAPI api = new IPGeolocationAPI("7461e5a511964d22ac7310cf8a9e4f02"); GeolocationParams geoParams = new GeolocationParams(); geoParams.SetIp(ip); Geolocation geolocation = api.GetGeolocation(geoParams); if (geolocation.GetStatus() == 200) { var location = geolocation.GetCity(); repo.UpdateLocation(Current_idUser, location); return(location); } return("Default"); }
public string GetCity() { return(geoInfo != null?geoInfo.GetCity() : string.Empty); }