private void moveCurrentCarToCarHistory(Employee employee) { Car currentCar = carRepository.findOne(employee.getCurrentCar().getId()); Set<Car> carHistory = employee.getCarHistory(); carHistory.add(employee.getCurrentCar()); if (currentCar.getEndLeasing().isAfter(LocalDate.now()) && !(currentCar.getEndLeasing().isEqual(LocalDate.now()))) { currentCar.setInThePool(true); } carRepository.save(currentCar); }
public void updatePoolCar(Car car) { car.setInThePool(false); car.setStartLeasing(LocalDate.now()); carRepository.save(car); }