public async Task <IHttpActionResult> Lock() { Cruise cruise = await _cruiseRepository.GetActiveAsync(); if (null == cruise) { return(NotFound()); } try { cruise.IsLocked = !cruise.IsLocked; await _cruiseRepository.UpdateMetadataAsync(cruise); return(Ok(IsLockedResult.FromCruise(cruise))); } catch (Exception ex) { _log.Error(ex, "An unexpected exception occurred while locking/unlocking the active cruise."); throw; } }
public async Task <IHttpActionResult> Lock(string reference) { Booking booking = await TryFindBookingInActiveCruiseByReference(reference); if (null == booking) { return(NotFound()); } try { booking.IsLocked = !booking.IsLocked; await _bookingRepository.UpdateIsLockedAsync(booking); _log.Info("{0}ocked booking {1}.", booking.IsLocked ? "L" : "Unl", booking.Reference); return(Ok(IsLockedResult.FromBooking(booking))); } catch (Exception ex) { _log.Error(ex, $"An unexpected exception occurred while locking/unlocking the booking with reference {reference}."); throw; } }