public void UpdateFollowingStations(BusStation busStation1, BusStation busStation2, Action <FollowingStations> update) { FollowingStations following = DataSource.ListFollowingStations.Find(s => s.KeyStation1 == busStation1.BusStationKey && s.KeyStation2 == busStation2.BusStationKey); update(following); }
public FollowingStations GetFollowingStations(BusStation station1, BusStation station2) { FollowingStations fsToReturn = DataSource.ListFollowingStations.Find(f => f.KeyStation1 == station1.BusStationKey && f.KeyStation2 == station2.BusStationKey); if (fsToReturn != null) { return(fsToReturn.Clone()); } else { return(null); } }
public void UpdateFollowingStations(BusStation station1, BusStation station2) { FollowingStations folStat = DataSource.ListFollowingStations.Find(s => s.KeyStation1 == station1.BusStationKey && s.KeyStation2 == station2.BusStationKey); if (folStat != null) { DataSource.ListFollowingStations.Remove(folStat); AddFollowingStations(station1, station2); } else { throw new ArgumentException("Following stations between " + station1 + " and " + station2 + " doesn't exist"); } }