Ejemplo n.º 1
0
 public Task AddFlight([FromBody] Flight flight, string flightType, string travelIdentity)
 {
     if (flightType == "to")
     {
         return(_travelService.AddToFlight(flight, travelIdentity));
     }
     if (flightType == "from")
     {
         return(_travelService.AddFromFlight(flight, travelIdentity));
     }
     throw new TravelPlannerException(400, "Bad flight type: choose either 'to' or 'from'");
 }