コード例 #1
0
ファイル: GTFS.cs プロジェクト: mbmccormick/OneTransitAPI
        public override List<Route> GetRoutes()
        {
            List<Route> result = new List<Route>();

            var routes = from r in db.GTFS_Routes where r.PartitionKey == agency.PartitionKey select r;
            foreach (var r in routes)
            {
                Route rt = new Route();
                rt.ID = r.ID;
                rt.ShortName = r.ShortName;
                rt.LongName = r.LongName;
                rt.Type = (int)r.Type;

                result.Add(rt);
            }

            return result;
        }
コード例 #2
0
        public override List<Route> GetRoutes()
        {
            System.Net.WebClient client = new System.Net.WebClient();
            var jsonResult = client.DownloadString("http://api.routeshout.com/v1/rs.routes.getList?key=" + APIKey + "&agency=" + this.TransitAgency.AgencyID);

            List<Route> result = new List<Route>();

            foreach (var r in Json.Decode(jsonResult).response)
            {
                Route rt = new Route();
                rt.ID = r.id;
                rt.ShortName = r.short_name;
                rt.LongName = r.long_name;

                result.Add(rt);
            }

            return result;
        }