示例#1
0
        public JsonResult Index(string id)
        {
            var location = LocationUtils.CreateCustomLocation(id);

            if (location == null)
            {
                throw new ArgumentException("InvalidLocation");
            }

            var poisWithDiagnostics = StopByStopService.RouteServiceInstance.GetPois(location);

            return(Json(poisWithDiagnostics.Pois, JsonRequestBehavior.AllowGet));
        }
示例#2
0
        public static bool GetRouteLocationsFromRoutePathId(
            string routePathId,
            out Location fromLocation,
            out Location toLocation)
        {
            fromLocation = Location.Unknown;
            toLocation   = Location.Unknown;

            if (!string.IsNullOrEmpty(routePathId) && routePathId.Contains("-to-"))
            {
                string[] parts = routePathId.Split(new string[] { "-to-" }, StringSplitOptions.RemoveEmptyEntries);
                string   from  = parts[0];
                string   to    = parts[1];

                fromLocation = LocationUtils.CreateCustomLocation(from);
                if (fromLocation == null || fromLocation == Location.Unknown)
                {
                    fromLocation = StopByStopService.PlacesServiceInstance.GetLocationFromPlaceId(from);
                }

                toLocation = StopByStopService.PlacesServiceInstance.GetLocationFromPlaceId(to);
            }

            if (fromLocation == null)
            {
                fromLocation = Location.Unknown;
            }

            if (toLocation == null)
            {
                toLocation = Location.Unknown;
            }


            return(fromLocation != Location.Unknown &&
                   toLocation != Location.Unknown);
        }