Exemplo n.º 1
0
        /// <summary>
        /// Create a new tournament.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="type"></param>
        /// <param name="url"> </param>
        /// <param name="parameters"> </param>
        /// <returns></returns>
        public Tournament TournamentCreate(string name, TournamentType type, string url, TournamentCreateParameters parameters = null)
        {
            string apiUrl = string.Format("tournaments");

            var param = new Dictionary<string, dynamic>();
            if (parameters != null)
            {
                param = parameters.ToDictionary();
            }

            if (!param.ContainsKey("tournament") || param["tournament"] == null)
            {
                param["tournament"] = new Dictionary<string, dynamic>();
            }

            param["tournament"]["name"] = name;
            param["tournament"]["tournament_type"] = type.ToChallongeString();
            param["tournament"]["url"] = url;

            var json = this.MakeJsonRequest(apiUrl, WebRequestMethods.Http.Post, param);
            return Deserializer.Tournament(json);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create a new tournament.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="type"></param>
        /// <param name="url"> </param>
        /// <param name="parameters"> </param>
        /// <returns></returns>
        public Tournament TournamentCreate(string name, TournamentType type, string url, TournamentCreateParameters parameters = null)
        {
            string apiUrl = string.Format("tournaments");

            var param = new Dictionary <string, dynamic>();

            if (parameters != null)
            {
                param = parameters.ToDictionary();
            }

            if (!param.ContainsKey("tournament") || param["tournament"] == null)
            {
                param["tournament"] = new Dictionary <string, dynamic>();
            }

            param["tournament"]["name"]            = name;
            param["tournament"]["tournament_type"] = type.ToChallongeString();
            param["tournament"]["url"]             = url;

            var json = this.MakeJsonRequest(apiUrl, WebRequestMethods.Http.Post, param);

            return(Deserializer.Tournament(json));
        }
Exemplo n.º 3
0
 public CreateRequest SetTournamentType(TournamentType value)
 {
     parameters["tournament_type"] = value.ToChallongeString(); return(this);
 }