public async Task <ActionResult <Flight> > Get([FromQuery] DateTime relative_to) { var currTime = TimeZoneInfo.ConvertTimeToUtc(relative_to); List <Flight> flights; string s = Request.QueryString.Value; if (s.Contains("sync_all")) { // Get the flights from the db and all the servers. flights = await model.GetAllFlights(currTime); } else { //Get the flight only from the db. flights = await model.GetFlights(currTime); } // There are no flights in this current time. if (flights == null || flights.Count == 0) { return(NoContent()); } // There were problems with connecting to some of the servers. if (flights[0].FlightId.Equals("server")) { flights.RemoveAt(0); return(StatusCode(500, flights)); } // There were validation problems with some of the flights. if (flights[0].FlightId.Equals("valid")) { flights.RemoveAt(0); return(BadRequest(flights)); } return(Ok(flights)); }