public IActionResult Index() { Geo.GeoServiceClient gsc = new Geo.GeoServiceClient(); try { var chk = gsc.KnockKnockAsync("81D88791-EF6D-417D-9E6B-049DC642684A").Result ?? ""; if (!chk.Equals("81D88791-EF6D-417D-9E6B-049DC642684A")) { throw new ApplicationException(); } } catch { ViewData["WCFEndpointError"] = $"Failed to establish a connection to Heatmap Geo Data Service at {gsc.Endpoint.Address}. Please check service availability and restart browser."; } return(View()); }
public async Task <JsonResult> GetGeoData() { Geo.GeoServiceClient gsc = new Geo.GeoServiceClient(); try { Geo.OrderGeoDataPoint[] geoDataPoints = await gsc.GetOrderDataPointsAsync(); var model = new HeatmapCoordinates().Points = geoDataPoints.Select(dp => new HeatmapDataPoint() { Latitude = dp.Latitude, Longitude = dp.Longitude }).ToList(); return(Json(model)); } catch (FaultException <Geo.DataServiceFault> fault) { Response.StatusCode = (int)System.Net.HttpStatusCode.InternalServerError; return(Json(new { success = false, responseText = $"{fault.Detail} - {fault.Message}" })); } finally { await gsc.CloseAsync(); } }