public void Load(TrackTrackerRepository repository) { if (Loaded) { return; } if (Trip == null) { Trip = repository.TripsCache.First(x => x.TripId == TripId); TripHeadsign = Trip.TripHeadsign; } if (StopTimes == null) { StopTimes = repository.GetTripStopTimes(Trip).OrderBy(x => x.ArrivalTime).Select(x => new StopTimeMinified { ArrivalTimeRaw = x.ArrivalTimeRaw, DepartureTimeRaw = x.DepartureTimeRaw, StopId = x.StopId, ShapeDistanceTraveled = x.ShapeDistTraveled.Value }).ToList(); } TripShapes = repository.GetTripShapes(Trip).ToList(); Stops = StopTimes.Select(x => repository.StopsCache.First(s => s.StopId == x.StopId)).ToList(); Loaded = true; }
public ActionResult DeleteConfirmed(int id) { StopTimes stopTimes = db.StopTimes.Find(id); db.StopTimes.Remove(stopTimes); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "id,trip_id,arrival_time,departure_time,stop_id,stop_sequence")] StopTimes stopTimes) { if (ModelState.IsValid) { //stopTimes.pickup_type = 0; //stopTimes.drop_off_type = 0; db.Entry(stopTimes).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(stopTimes)); }
// GET: StopTime/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } StopTimes stopTimes = db.StopTimes.Find(id); if (stopTimes == null) { return(HttpNotFound()); } return(View(stopTimes)); }
public ActionResult Create([Bind(Include = "id,trip_id,arrival_time,departure_time,stop_id,stop_sequence")] StopTimes stopTimes) { if (ModelState.IsValid) { stopTimes.pickup_type = 0; stopTimes.drop_off_type = 0; db.StopTimes.Add(stopTimes); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(stopTimes)); }
public void Accept(IFeedVisitor visitor) { Agencies.Accept(visitor); Stops.Accept(visitor); Routes.Accept(visitor); Trips.Accept(visitor); StopTimes.Accept(visitor); Calendars.Accept(visitor); CalendarDates.Accept(visitor); FareAttributes.Accept(visitor); FareRules.Accept(visitor); Shapes.Accept(visitor); Frequencies.Accept(visitor); Transfers.Accept(visitor); FeedInfos.Accept(visitor); }
public void Accept(IFeedVisitor visitor) { Parallel.Invoke( () => Agencies.Accept(visitor), () => Stops.Accept(visitor), () => Routes.Accept(visitor), () => Trips.Accept(visitor), () => StopTimes.Accept(visitor), () => Calendars.Accept(visitor), () => CalendarDates.Accept(visitor), () => FareAttributes.Accept(visitor), () => FareRules.Accept(visitor), () => Shapes.Accept(visitor), () => Frequencies.Accept(visitor), () => Transfers.Accept(visitor), () => FeedInfos.Accept(visitor) ); }
private void PopulateData(Response <StopTime> callbackData) { List <StopTime> content = callbackData.content; HasMore = callbackData.hasMore; TripsCache.Instance.GetTrips( content.Select((stopTime) => { return(stopTime.tripId); }), () => { foreach (StopTime stopTime in content) { StopTimes.Add( new StopTimeViewModel(stopTime, TripsCache.Instance.Get(stopTime.tripId)) ); } ShowMoreButton = true; page++; } ); }
public bool IsTrainRunning(DateTime currentTime, TrackTrackerRepository repository) { var firstStopTime = StopTimes.FirstOrDefault(); var lastStopTime = StopTimes.LastOrDefault(); if (firstStopTime == null || lastStopTime == null) { TrainRunning = false; return(false); } // ReSharper disable PossibleInvalidOperationException if (firstStopTime.DepartureTime.TimeOfDay < currentTime.TimeOfDay && lastStopTime.ArrivalTime.TimeOfDay > currentTime.TimeOfDay) { TrainRunning = true; return(repository.IsTripRunning(Trip, currentTime)); } TrainRunning = false; return(false); }