public IActionResult NewAP([FromServices] WgsDis WgsDis, bool?raw) { var towers = DB.Towers .GroupBy(x => x.District) .ToList(); var ret = new List <KeyValuePair <Tower, Tower> >(); foreach (var x in towers) { ret.AddRange(WgsDis.Solve(x.ToList())); } ret = ret.Where(x => x.Key.Status == TowerStatus.预选 || x.Value.Status == TowerStatus.预选).ToList(); if (raw.HasValue && raw.Value == true) { return(XlsView(ret, "export.xls", "~/Views/Tower/ExportNewAP.cshtml")); } else { return(View(ret)); } }
public IActionResult Sharing(double left, double right, double top, double bottom, [FromServices] WgsDis WgsDis) { var towers = DB.Towers .Where(x => x.Lon >= left) .Where(x => x.Lon <= right) .Where(x => x.Lat >= bottom) .Where(x => x.Lat <= top) .GroupBy(x => x.District) .ToList(); var ret = new List <KeyValuePair <Tower, Tower> >(); foreach (var x in towers) { ret.AddRange(WgsDis.Solve(x.ToList())); } return(Json(ret.Select(x => new { BeginLat = x.Key.Lat, EndLat = x.Value.Lat, BeginLon = x.Key.Lon, EndLon = x.Value.Lon, Status = x.Key.Status }))); }