@Override public boolean cancelBindingJudgeToGame(int gamesId, int positionIndex) { YsmsGamesJudge gamesJudge = gamesJudgeDao.getJudgeByGameAndPosition(gamesId, positionIndex); if (gamesJudge != null) { gamesJudgeDao.delete(gamesJudge); } return true; }
@Override public boolean bindJudgeToGame(int judgeId, int gamesId, int positionIndex) { YsmsGamesJudge gamesJudge = gamesJudgeDao.getJudgeByGameAndPosition(gamesId, positionIndex); if (gamesJudge != null) { gamesJudgeDao.delete(gamesJudge); } YsmsJudge judge = judgeDao.findById(judgeId); YsmsGames game = gamesDao.findById(gamesId); YsmsGamesJudge newGamesJudge = new YsmsGamesJudge(); newGamesJudge.setJudgePosition(positionIndex); newGamesJudge.setYsmsGames(game); newGamesJudge.setYsmsJudge(judge); gamesJudgeDao.save(newGamesJudge); return true; }