Пример #1
0
        public async Task UpdateUserAsync(UserUpdate userUpdate)
        {
            string url = string.Format("{0}/{1}", URL.RESTRoot, "user");

            string authzHeader = AuthorizationHeader.CreateForREST(Config.ConsumerKey, Config.ConsumerSecret, AuthToken.Token, AuthToken.TokenSecret, url, "PUT");

            string serializeObject = JsonConvert.SerializeObject(userUpdate);

            HttpContent httpContent = new StringContent(serializeObject);

            HttpRequestItem httpRequestItem = new HttpRequestItem()
            {
                URL = url,
                HttpMethod = HttpMethod.Put,
                AuthzHeader = authzHeader,
                HttpContent = httpContent,
                IsDataRequest = true
            };

            HttpRequestHandler httpRequestHandler = new HttpRequestHandler();
            string executeAsync = await httpRequestHandler.ReadAsStringAsync(httpRequestItem);

            //TODO : Investigate
            //return JsonConvert.DeserializeObject<User>(executeAsync);
        }
Пример #2
0
        private async void UpdateButton_Click(object sender, RoutedEventArgs e)
        {
            UserUpdate userUpdate = new UserUpdate()
            {
                FirstName = FirstName.Text,
                LastName = LastName.Text,
            };

            await copyClient.UserManager.UpdateUserAsync(userUpdate);
        }