示例#1
0
        public GetTournamentGamesResponse GetTournamentGames(int tournamentId)
        {
            GetTournamentGamesResponse response = new GetTournamentGamesResponse();

            if (tournamentId < 1)
            {
                AddErrorToResponse(response, "Tournament ID is not valid.");
                return(response);
            }

            var connectionString = _settings.TournamentDB;

            using (var dataStore = new DataStore(new SqlConnection(connectionString)))
            {
                try
                {
                    response.games = dataStore.GetTournamentGames(tournamentId);
                }
                catch (Exception e)
                {
                    AddErrorToResponse(response, e.Message);
                }

                return(response);
            }
        }
示例#2
0
        public GetTournamentGamesResponse GetTournamentKnockoutGames(int tournamentId)
        {
            var connectionString = _settings.TournamentDB;

            using (var dataStore = new DataStore(new SqlConnection(connectionString)))
            {
                GetTournamentGamesResponse response = new GetTournamentGamesResponse();

                try
                {
                    response.games = dataStore.GetTournamentGames(tournamentId, RoundTypes.KNOCKOUT_ANY);
                }
                catch (Exception e)
                {
                    AddErrorToResponse(response, e.Message);
                }

                return(response);
            }
        }