コード例 #1
0
        public int PostBooking(Booking booking)
        {
            if (!ModelState.IsValid)
            {
                try
                {
                    //Call AddFlight method to fetch all Flight
                    int BookingId = bs.PostBooking(booking);

                    //return the response
                    return(BookingId);
                }
                catch (FlightException)
                {
                    //rethrow
                    throw;
                }
            }
            else
            {
                //throw user defined exception object
                throw new BookingsException("The entered details are not valid");
            }
        }