コード例 #1
0
 public async Task <IActionResult> GetFlightsAsync([FromQuery] string relative_to, [FromQuery] string sync_all)
 {
     Flight[] flights;
     if (Request.QueryString.Value.Contains("sync_all"))
     {
         //gets flights also from remote servers
         try
         {
             flights = await flightManager.GetAllFlightsRelativeToAsync(relative_to);
         }
         catch (Exception e)
         {
             return(BadRequest(e.Message));
         }
     }
     else
     {
         //gets flight just from this server.
         try
         {
             flights = await flightManager.GetFlightsRelativeToAsync(relative_to);
         }
         catch (Exception e)
         {
             return(BadRequest(e.Message));
         }
     }
     return(Ok(flights));
 }