public void updateUser(Long userId, String lastName, String firstName) { UserDTO currUser = getUser(userId); currUser = new UserDTO(userId, lastName, firstName, currUser.getEmail(), currUser.getRentalIds()); userService.saveOrUpdateUser(currUser); invalidateCache(); }
public void visitRentalsOfUser(Long userId, RentalVisitor visitor) { UserDTO user = userService.getUserById(userId); for (Long id : user.getRentalIds()) { RentalDTO r = rentalService.getRentalById(id); MovieDTO movie = movieService.getMovieById(r.getMovieId()); visitor.visit( r.getId(), r.getRentalDays(), r.getRentalDate(), user.getLastName(), user.getFirstName(), movie.getTitle(), r.getRemainingDays(), r.getRentalFee()); } }