Beispiel #1
0
        private static void UpdateTravelTimeInDB(RouteStop routeStop)
        {
            var dbRouteStop = (from rs in db.RouteStops
                               where rs.ID == routeStop.ID
                               select rs).FirstOrDefault();

            if (dbRouteStop == null)
            {
                return;
            }
            dbRouteStop.AverageTravelTimeToNextStop = routeStop.AverageTravelTimeToNextStop;
            db.SaveChanges();
        }
Beispiel #2
0
        private static void UpdateStopArrivalTime(RouteStop currentRouteStop)
        {
            if (currentRouteStop == null)
            {
                return;
            }
            currentRouteStop.LastTimeAtStop = UTCToLocalTime.LocalTimeFromUTC(DateTime.UtcNow);

            var dbRouteStop = (from rs in db.RouteStops
                               where rs.ID == currentRouteStop.ID
                               select rs).FirstOrDefault();

            if (dbRouteStop == null)
            {
                return;
            }
            dbRouteStop.LastTimeAtStop = currentRouteStop.LastTimeAtStop;
            db.SaveChanges();
        }