Exemple #1
0
        public IHttpActionResult GetRoutes(string route_id, string trip_id, string start_time)
        {
            NaviRoute naviRoute = new NaviRoute();

            naviRoute.navi_stops = db.Database
                                   .SqlQuery <NaviStop>("StopsGetByRoute @route_id",
                                                        new SqlParameter("@route_id", route_id))
                                   .ToList();

            naviRoute.navi_shapes = db.Database
                                    .SqlQuery <Shapes>("ShapesGetByRoute @route_id",
                                                       new SqlParameter("@route_id", route_id))
                                    .ToList();

            naviRoute.TripPrevious = db.Database
                                     .SqlQuery <NaviTripHistory>("TripGetPreviousV2 @trip_id, @trip_time",
                                                                 new SqlParameter("@trip_id", trip_id), new SqlParameter("@trip_time", start_time))
                                     .ToList();

            naviRoute.TripNext = db.Database
                                 .SqlQuery <NaviTripHistory>("TripGetNextV2 @trip_id, @trip_time",
                                                             new SqlParameter("@trip_id", trip_id), new SqlParameter("@trip_time", start_time))
                                 .ToList();

            List <NaviRoute> naviRoutes = new List <NaviRoute>();

            naviRoutes.Add(naviRoute);

            if (naviRoutes == null)
            {
                return(NotFound());
            }

            return(Ok(naviRoutes));
        }
Exemple #2
0
        // GET: Route
        public ActionResult Index(string route_id, string trip_id, string stop_id, string trip_date, string trip_time, string direction_id)
        {
            NaviRoute naviRoute = new NaviRoute();

            naviRoute.navi_stops = db.Database
                                   .SqlQuery <NaviStop>("StopsGetByTripId @trip_id, @trip_date, @trip_time",
                                                        new SqlParameter("@trip_id", trip_id),
                                                        new SqlParameter("@trip_date", trip_date),
                                                        new SqlParameter("@trip_time", trip_time))
                                   .ToList();

            naviRoute.navi_shapes = db.Database
                                    .SqlQuery <Shapes>("ShapesGetByRoute @route_id",
                                                       new SqlParameter("@route_id", route_id))
                                    .ToList();

            naviRoute.TripPrevious = db.Database
                                     .SqlQuery <NaviTripHistory>("TripGetPreviousV2 @trip_id, @trip_date, @trip_time",
                                                                 new SqlParameter("@trip_id", trip_id),
                                                                 new SqlParameter("@trip_date", trip_date),
                                                                 new SqlParameter("@trip_time", trip_time))
                                     .ToList();

            naviRoute.TripNext = db.Database
                                 .SqlQuery <NaviTripHistory>("TripGetNextV2 @trip_id, @trip_date, @trip_time",
                                                             new SqlParameter("@trip_id", trip_id),
                                                             new SqlParameter("@trip_date", trip_date),
                                                             new SqlParameter("@trip_time", trip_time))
                                 .ToList();

            naviRoute.ReverseTrip = db.Database
                                    .SqlQuery <NaviReverseTrip>("TripGetReverse @route_id, @trip_id, @stop_id, @travel_time",
                                                                new SqlParameter("@route_id", route_id),
                                                                new SqlParameter("@trip_id", trip_id),
                                                                new SqlParameter("@stop_id", stop_id),
                                                                new SqlParameter("@travel_time", trip_time))
                                    .ToList();

            naviRoute.SelectedRouteId     = route_id;
            naviRoute.SelectedTripId      = trip_id;
            naviRoute.SelectedStopId      = stop_id;
            naviRoute.SelectedDirectionId = direction_id;
            naviRoute.SelectedTripDate    = trip_date;
            naviRoute.SelectedTripTime    = trip_time;

            return(View(naviRoute));
        }