Beispiel #1
0
        public GetTournamentResponse Get(int id)
        {
            GetTournamentResponse response = new GetTournamentResponse();

            if (id < 1)
            {
                AddErrorToResponse(response, "ID is not valid.");
                return(response);
            }
            var connectionString = _settings.TournamentDB;

            using (var dataStore = new DataStore(new SqlConnection(connectionString)))
            {
                try
                {
                    response.Tournament = dataStore.GetTournament(id);
                }
                catch (Exception e)
                {
                    AddErrorToResponse(response, e.Message);
                }

                return(response);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Translates the tournament status.
        /// </summary>
        /// <param name="apiResponseTournament">The API response tournament.</param>
        /// <returns></returns>
        private String TranslateTournamentStatus(GetTournamentResponse apiResponseTournament)
        {
            if (apiResponseTournament.HasResultBeenProduced)
            {
                return("Resulted");
            }

            if (apiResponseTournament.HasBeenCancelled)
            {
                return("Cancelled");
            }

            if (apiResponseTournament.HasBeenCompleted)
            {
                return("Completed");
            }

            return("Created");
        }