public async Task<ActionResult> ByIpHtml(CancellationToken cancellationToken) { var ipServiceClient = new FGIServiceClient(); string ipAddress = getClientIp(); var ipAddressTask = ipServiceClient.GetGeoIpInfoAsync( ipAddress, FreeGeoIpWebServiceClient.ResultType.Json, cancellationToken); await Task.WhenAll(ipAddressTask); var weatherServiceClient = new OWMServiceClient(); weatherServiceClient.SetSearchCriteriaStrategy( new SearchByGeolocation( ipAddressTask.Result.latitude, ipAddressTask.Result.longitude )); var weatherTask = weatherServiceClient.GetWeatherAsync(OpenWeatherMapWebServiceClient.ResultType.Html, cancellationToken); await Task.WhenAll(weatherTask); return Content(weatherTask.Result.ToString()); }
private GeoLocaitonTest() { serviceClient = new FGIServiceClient(); }