Exemplo n.º 1
0
        /**
         * Register user in system
         *
         * @return void
         */
        public static void Register(AccountApi account)
        {
            var helper = new Data();
            IDictionary <string, string> data = new Dictionary <string, string>();
            IDictionary <string, string> head = new Dictionary <string, string>();

            data["username"] = account.Username;
            head["token"]    = account.Token;
            head["accept"]   = helper.getOutputType();

            JToken responseJSON = ApiAsian.sendRequest(data, head, helper.getRegisterUrl());

            if (!ApiModel.Valid(responseJSON))
            {
                throw new Exception((String)responseJSON.SelectToken("Result").SelectToken("TextMessage"));
            }

            account.AOToken = (String)responseJSON.SelectToken("Result").SelectToken("Token");
        }
Exemplo n.º 2
0
        public JToken GetLeagues()
        {
            var helper = new Data();
            IDictionary <string, string> data = new Dictionary <string, string>();
            IDictionary <string, string> head = new Dictionary <string, string>();

            data["username"]     = account.Username;
            data["marketTypeId"] = account.MarketTypeId.ToString();
            data["sports"]       = account.sportsType.ToString();

            head["token"]  = account.Token;
            head["accept"] = helper.getOutputType();

            JToken responseJson = sendRequest(data, head, helper.getLeaguesUrl());

            if (!ApiModel.Valid(responseJson))
            {
                throw new Exception("Leagues Error");
            }

            return(responseJson);
        }