Пример #1
0
        public ActionResult GetFarestStat()
        {
            TraceIpReport report = _traceIpservice.GetReportByFarestCountry();

            if (report != null)
            {
                return(Ok(report.ToString()));
            }
            else
            {
                return(Ok("Theres no data in the TraceIp Report database. Call /api/traceip?... to generate a new report."));
            }
        }
Пример #2
0
        public async Task <ActionResult> TraceIp([FromQuery] string ip)
        {
            try
            {
                if (String.IsNullOrEmpty(ip))
                {
                    return(BadRequest("Missing IP."));
                }

                TraceIpReport report = await _traceIpservice.GetTraceReport(ip);

                if (report == null)
                {
                    return(BadRequest("Invalid or missing IP address."));
                }

                return(Ok(report.ToString()));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex));
            }
        }