public IActionResult ConfirmBooking(long id, [FromBody] long bookingId) { try { Booking booking = _bookingRepository.GetById(bookingId); if (booking == null) { return BadRequest("Invalid booking id: " + bookingId); } Customer customer = _customerRepository.GetById(id); if (customer == null) { return BadRequest("Invalid customer id: " + id); } if (!_bookingsService.ConfirmBooking(customer, booking)) { return BadRequest("Unable to confirm booking"); } _customerRepository.SaveChanges(); return Ok(); } catch (Exception e) { return StatusCode(500, new { error = e.Message }); } }