public override async Task ListFlights(FlightCriteria request, IAsyncStreamWriter <FlightInfo> responseStream, ServerCallContext context) { var flightInfos = _flightStore.Flights.Select(x => x.Value.GetFlightInfo()).ToList(); foreach (var flightInfo in flightInfos) { await responseStream.WriteAsync(flightInfo); } }
public override async Task ListFlights( FlightCriteria request, IAsyncStreamWriter <FlightInfo> responseStream, ServerCallContext context ) { foreach (var flight in _flightData.Flights.Values) { await responseStream.WriteAsync(flight); } }
public AsyncServerStreamingCall <FlightInfo> ListFlights(FlightCriteria criteria = null, Metadata headers = null) { if (criteria == null) { criteria = FlightCriteria.Empty; } var response = _client.ListFlights(criteria.ToProtocol(), headers); var convertStream = new StreamReader <Protocol.FlightInfo, FlightInfo>(response.ResponseStream, inFlight => new FlightInfo(inFlight)); return(new AsyncServerStreamingCall <FlightInfo>(convertStream, response.ResponseHeadersAsync, response.GetStatus, response.GetTrailers, response.Dispose)); }
public override async Task ListFlights(FlightCriteria request, IAsyncStreamWriter <FlightInfo> responseStream, ServerCallContext context) { var tables = _koraliumTransportService.GetTables(); var httpContext = context.GetHttpContext(); foreach (var table in tables) { var selectAllSql = table.SelectAllColumnsStatement(); await responseStream.WriteAsync(GetFlightInfo(selectAllSql, context)); } }
private async Task <BrandedFareInfo> GetFareBrandInfo(FlightCriteria criteria, string token, int criteriaIndex) { BrandedFareInfo response = null; try { string origin = criteria.Origin.Trim(); string dest = criteria.Destination.Trim(); string url = string.Format("{0}/{1}/{2}/{3}/{4}", ConfigurationManager.AppSettings["BrandedFareServiceUrl"], origin, dest, Constants.AirportCountryCodes[origin], Constants.AirportCountryCodes[dest]); response = await _httpClentService.GetAsync <BrandedFareInfo>(url, token); response.SegmentId = criteriaIndex; } catch (Exception ex) { string json = File.ReadAllText(@"D:\Sreekanth\Work\POCs\Ethihad Web\Temp\AUH_BAH BrandedFares.json"); response = Newtonsoft.Json.JsonConvert.DeserializeObject <BrandedFareInfo>(json); response.SegmentId = criteriaIndex; } return(response); }
public virtual Task ListFlights(FlightCriteria request, IAsyncStreamWriter <FlightInfo> responseStream, ServerCallContext context) { throw new NotImplementedException(); }