//CRUD #region AdjacentStation public void AddAdjacentStation(AdjacentStation adjacentStation)//IDL function { if (DataSource.AdjacentStations.FirstOrDefault(stations => stations.Station1 == adjacentStation.Station1 && stations.Station2 == adjacentStation.Station2 && !stations.Deleted) == null) { DataSource.AdjacentStations.Add(adjacentStation.Clone()); } }
public void UpdateAdjacentStation(AdjacentStation newAdjacentStation)//IDL function { AdjacentStation cur = DataSource.AdjacentStations.FirstOrDefault(stations => (stations.Station1 == newAdjacentStation.Station1 && stations.Station2 == newAdjacentStation.Station2) || (stations.Station1 == newAdjacentStation.Station2 && stations.Station2 == newAdjacentStation.Station1) && !stations.Deleted); if (cur == null) { throw new AdjacentStationExceptions(newAdjacentStation.Station1, newAdjacentStation.Station2, false); } DataSource.AdjacentStations.Remove(cur); DataSource.AdjacentStations.Add(newAdjacentStation.Clone()); }
public AdjacentStation GetAdjacentStation(int station1, int station2)//IDL function { AdjacentStation retValue = DataSource.AdjacentStations.FirstOrDefault(stations => (stations.Station1 == station1 && stations.Station2 == station2) || (stations.Station1 == station2 && stations.Station2 == station1) && !stations.Deleted); if (retValue != null) { return(retValue.Clone()); } else { throw new AdjacentStationExceptions(station1, station2, false); } }