private Club convertClub(ClubData clubData) { Club club = new Club(); club.setName(clubData.getName()); club.setAcronym(clubData.getAcronym().toUpperCase()); club.setCoach(convertCoach(clubData.getCoach())); return club; }
@Override public void updateClub(ClubData clubData) { Club club = findClub(clubData.getAcronym()); club.setName(clubData.getName()); Coach coach = club.getCoach(); coach.setName(clubData.getCoach().getName()); coach.setMail(clubData.getCoach().getEmail()); coach.setTel(clubData.getCoach().getPhoneNumber()); clubRepository.save(club); }
private ClubData convertToClubData(Club club) { Coach coach = club.getCoach(); CoachData coachData = new CoachData(coach.getName(), coach.getTel(), coach.getMail()); return new ClubData(club.getName(), club.getAcronym(), coachData); }