diff --git a/src/main/java/com/swp/PodBookingSystem/service/AmenityService.java b/src/main/java/com/swp/PodBookingSystem/service/AmenityService.java index d3de5a3b..ecfc35a2 100644 --- a/src/main/java/com/swp/PodBookingSystem/service/AmenityService.java +++ b/src/main/java/com/swp/PodBookingSystem/service/AmenityService.java @@ -59,7 +59,7 @@ public AmenityResponse updateAmenity(int amenityId, AmenityCreationRequest reque public String deleteAmenity(int amenityId){ Amenity existingAmenity = amenityRepository.findById(amenityId) .orElseThrow(() -> new EntityNotFoundException("Amenity not found")); - existingAmenity.setIsDeleted(1); + existingAmenity.setIsDeleted(existingAmenity.getIsDeleted() == 1 ? 0 : 1); amenityRepository.save(existingAmenity); return "Delete amenity " + amenityId + " successfully"; }