public IActionResult Index() { ipaddress addr = new ipaddress(); addr.ip = "75.33.55.88"; return(View(addr)); }
public IActionResult GetLocation(ipaddress ipaddr) { // Call service to get location information based on IP address // URL is stored in an environment variable ipaddr.ip = "75.75.33.22"; string url = Environment.GetEnvironmentVariable("LOCATION_SERVICE_URI"); url = "http://locationms:8080"; Console.WriteLine("LOCATION_SERVICE_URI: " + url); RestClient client = new RestClient(url); var request = new RestRequest("/{ipaddr}", Method.GET); request.AddUrlSegment("ipaddr", ipaddr.ip); Console.WriteLine("Looking up: " + ipaddr.ip); IRestResponse response = client.Execute(request); var content = response.Content; // raw content as string ViewData["LocationJSON"] = content; return(View()); }