public BusStop GetStopIdFromStopCode(BusStop busBusStop) { var busStop = Utilities.GetIEnumerableJsonApiResponse(_atApiCredentials, "gtfs", "stops", "stopCode", busBusStop.StopCode).First(); var busStopId = busStop.Value<string>("stop_id") ?? ""; busBusStop.StopId = busStopId; return busBusStop; }
public ProgramMain() { var atApi = new ApiToAT.ApiToAT(ApiKey, ApiUrl); JsonSettings.MaxJsonLength = int.MaxValue; Get["/busStopCode={busStopCode}"] = parameters => { string busStopCode = parameters.busStopCode.ToString(); var busStop = new BusStop(busStopCode); busStop = atApi.GetStopIdFromStopCode(busStop); if (busStop.StopId.Length == 0) { return ""; } IEnumerable<Route> routes = atApi.GetRoutesFromId(busStop.StopId); routes = atApi.AddShapesToRoute(routes); routes = atApi.GetAllShapesCoordinatesFromShapeId(routes); busStop.Routes = routes; return Response.AsJson(busStop); }; Get["/"] = parameters => "Home Page"; }