Esempio n. 1
0
        public Account CreateCustomer(Customer customer)
        {
            //username & password will be both retrieved by login process
            _restSharpComponent.TokenizeRequest(new User() { username="******",
                                                             password ="******",
                                                             grant_type ="password"
                                                            });
            _wrapper = new HttpRequestWrapper(_restSharpComponent, "http://localhost:51313/api/customers", Method.POST);

            var serializedRequest = JsonConvert.SerializeObject(customer);

            _wrapper.Post(serializedRequest);

            var account = _wrapper.Execute<Account>();
            return account;
        }
Esempio n. 2
0
        public Account CreateCustomer(Customer customer)
        {
            //username & password will be both retrieved by login process
            _restSharpComponent.TokenizeRequest(new User()
            {
                username   = "******",
                password   = "******",
                grant_type = "password"
            });
            _wrapper = new HttpRequestWrapper(_restSharpComponent, "http://localhost:51313/api/customers", Method.POST);

            var serializedRequest = JsonConvert.SerializeObject(customer);

            _wrapper.Post(serializedRequest);

            var account = _wrapper.Execute <Account>();

            return(account);
        }