public Pdv Closest() { Pdv result = null; string latitude = Request.Query["lat"]; string longitude = Request.Query["lon"]; if (string.IsNullOrEmpty(latitude) || string.IsNullOrEmpty(longitude)) { return(result); } double lat, lon; lat = double.Parse(latitude); lon = double.Parse(longitude); var testPoint = new Point(new Position(lat, lon)); //Query to find the closest PDV var pdvs = CachePDVS(); foreach (var pdv in pdvs) { result = PdvRepository.SearchClosestPDV(result, lat, lon, testPoint, pdv); } return(result); }
public PDVController() { pdvRepository = new PdvRepository(); }