public IActionResult Post(int ScheduleId, [FromBody] BookingInfo bookingInfo) { try { if (ModelState.IsValid) { bookingInfo.ScheduleId = ScheduleId; var bookingConfirmed = _repository.AddBooking(bookingInfo); if (bookingConfirmed > 0) { return(Created(new Uri("/flights/booking", UriKind.Relative), bookingInfo)); } else { return(BadRequest("Booking not confirmed")); } } else { return(BadRequest(ModelState)); } } catch (Exception ex) { return(BadRequest(ExceptionHelper.ProcessError(ex))); } }