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))); }
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); }
public IActionResult GetFlight(int id) { var flight = service.GetFlightInfo(id); return(flight == null?NotFound($"Flight with id = {id} not found!") as IActionResult : Ok(flight)); }