public StationSchedule GetStationSchedule(string id) { var navigator = createDocNavigator(); // find the requested station by ID var i = navigator.Select("//PeatusLiinil[@refid = '" + id + "']"); var schedule = new StationSchedule(createStation(navigator.SelectSingleNode("//Peatus[@id = '" + id + "']"))); // for each stop in this station on any line... if(schedule != null) { while (i.MoveNext()) { // ...we add a departure to the station schedule var line = createLine(i.Current.SelectSingleNode("../..")); schedule.AddDeparture(line, PadTime(i.Current.SelectSingleNode("Aeg").ToString())); } } return schedule; }
public IActionResult SaveStationSchedule(StationSchedule <string> stationSchedule) { try { if (stationSchedule == null) { throw new FormatException("Not a valid Input"); } var dataResult = new Station <String>().SaveStationSchedules(stationSchedule); return(Ok(JsonSerializer.Serialize(dataResult))); } catch (Exception ex) { return(NotFound(ex.Message)); } finally { } }