public Task Execute(IJobExecutionContext context) { Console.WriteLine(); Console.WriteLine($"*** {context.JobDetail.Key} ***"); _jc.ProcessData(context.JobDetail.JobDataMap); Ip2locationDb11 obj = _ctx.Ip2locationDb11.Skip(1).Take(1).FirstOrDefault(); Console.WriteLine($"DB Query CONTEXT: " + obj.CityName); return(Task.CompletedTask); }
public void ProcessData(JobDataMap jdm) { foreach (string key in jdm.Keys) { Console.WriteLine($"{key} - {jdm[key]}"); } Console.WriteLine($"Setting IMAGE_PATH: {_settings.GetAppSetting("IMAGE_PATH")}"); Ip2locationDb11 obj = _ctx.Ip2locationDb11.Skip(2).Take(1).FirstOrDefault(); Console.WriteLine($"DB Query Write Context: " + obj.CityName); }
public ActionResult GetCityInfo(string ip) { IPAddress address = null; if (!string.IsNullOrWhiteSpace(ip) && !IPAddress.TryParse(ip, out address)) { return(BadRequest("Invalid Ip-Address")); } else { Ip2locationDb11 info = _controller.GetInfo(address == null ? _httpContextAccessor.HttpContext.Connection.RemoteIpAddress.ToString() : address.ToString()); if (info == null) { return(BadRequest("Not found")); } return(Ok(info.CityName)); }; }
public ActionResult GetInfo(Ip2LocationRequest request) { IPAddress address = null; if (!string.IsNullOrWhiteSpace(request.IpAddress) && !IPAddress.TryParse(request.IpAddress, out address)) { return(BadRequest("Invalid Ip-Address")); } else { Ip2locationDb11 info = _controller.GetInfo(address == null ? _httpContextAccessor.HttpContext.Connection.RemoteIpAddress.ToString() : address.ToString()); if (info == null) { return(BadRequest("Not found")); } return(new JsonResult(info) { StatusCode = StatusCodes.Status200OK }); }; }