Пример #1
0
        public IActionResult GetFlight(long id)
        {
            var flight = service.GetFlightInfo(id);

            return(flight == null?NotFound($"Flight with id = {id} not found!") as IActionResult
                   : Ok(mapper.Map <FlightDTO>(flight)));
        }
Пример #2
0
        public static async Task <Flight> GetDelayedFlight(this IFlightOperationsService service, long targetId, CancellationToken ct = default(CancellationToken))
        {
            TaskCompletionSource <Flight> tcs = new TaskCompletionSource <Flight>();

            System.Timers.Timer t = new System.Timers.Timer(1500);
            t.Elapsed += (s, e) =>
            {
                var result = service.GetFlightInfo(targetId);
                tcs.SetResult(result);
            };

            return(await tcs.Task);
        }
Пример #3
0
        public IActionResult GetFlight(int id)
        {
            var flight = service.GetFlightInfo(id);

            return(flight == null?NotFound($"Flight with id = {id} not found!") as IActionResult : Ok(flight));
        }