public ActionResult <string> AddWinLoss(int tournamentId, int winnerUserId, int loserUserId) { try { TournamentAlgorithm tournamentAlgorithm; Tournament tournament = unitOfWork.TournamentRepository.GetByID(tournamentId); if (tournament.TournamentStyle == "KnockOut") { tournamentAlgorithm = new KnockoutAlgorithm(unitOfWork); } else { return(StatusCode(500, "Something went wrong!")); } tournamentAlgorithm.RecordWinLoss(tournament.TournamentId, winnerUserId); return(StatusCode(200, "OK")); } catch (Exception) { return(StatusCode(500, "Something went wrong!")); } }
public ActionResult <List <Knockout> > GetTournamentMatches(int tournamentId) { try { TournamentAlgorithm tournamentAlgorithm; Tournament tournament = unitOfWork.TournamentRepository.GetByID(tournamentId); if (tournament.TournamentStyle == "KnockOut") { tournamentAlgorithm = new KnockoutAlgorithm(unitOfWork); } else { return(StatusCode(500, "Something went wrong!")); } return(tournamentAlgorithm.GetMatches(tournament.TournamentId)); } catch (Exception) { return(StatusCode(500, "Something went wrong!")); } }