// post request to add flights
        public async Task <HttpResponseMessage> PostAsync(Flight flight)
        {
            List <Airport> airports = await sqlDbHelper.GetAirports();

            List <Route> routes = await sqlDbHelper.GetRoutes();

            List <Flight> flights = await sqlDbHelper.GetFlights();

            // checks if there are a flight with the same passport number
            //checks if there's a route of the specific flight exists too
            if ((flights.Find(a => a.PassportNumber == flight.PassportNumber) == null) &&
                (routes.Find(a => a.FlightNumber == flight.FlightNumber) != null))
            {
                Route   route       = routes.Find(a => a.FlightNumber == flight.FlightNumber);
                Airport fromAirport = airports.Find(a => a.Code == route.Departure);
                Airport toAirport   = airports.Find(a => a.Code == route.Arrival);

                // if the route exists  and the flight does not exist, the price is calculated and the flight is added
                flight.Price = sqlDbHelper.PriceCalc(fromAirport.Latitude, fromAirport.Longitude,
                                                     toAirport.Latitude, toAirport.Longitude, flight.PassengerType);

                // a ok code is returned a long with the flight price
                await sqlDbHelper.AddFlight(flight);

                return(Request.CreateResponse(HttpStatusCode.OK, (int)flight.Price));
            }
            else
            {
                // in case the condition is not met, then a not found status code is returned
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }
        }