Пример #1
0
        public async Task <BaseStationBoard> GetDepartureBoardAsync(StationBoardRequest request)
        {
            _logger.LogInformation($"Calling departure board SOAP endpoint for {request.Crs}");
            if (request.Expand)
            {
                var boardWithDetails = await _soapClient.GetDepBoardWithDetailsAsync(
                    _mapperService.MapGetDepBoardWithDetailsRequest(request));

                return(boardWithDetails.GetStationBoardResult);
            }

            var board = await _soapClient.GetDepartureBoardAsync(
                _mapperService.MapGetDepartureBoardRequest(request));

            return(board.GetStationBoardResult);
        }
Пример #2
0
        public IEnumerable <ServiceItem2> GetTrainsTo(string crsFrom, string crsTo)
        {
            if (string.IsNullOrEmpty(crsFrom) || string.IsNullOrEmpty(crsTo))
            {
                throw new ArgumentException("CRS cannot be null or empty.");
            }
            var request = new GetDepartureBoardRequest
                          (
                new AccessToken {
                TokenValue = Environment.GetEnvironmentVariable("LDBWS_TOKEN")
            },
                10,
                crsFrom.ToUpper(),
                crsTo.ToUpper(),
                FilterType.to,
                0,
                60
                          );

            var trains = _service.GetDepartureBoardAsync(request);

            trains.Wait();
            return(trains.Result.GetStationBoardResult.trainServices);
        }