Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

C# Http.HttpRequestMessage

public static async Task<bool> ChangeUserProfile(String name, String url, String description, String location,
            UserAccountEntity userAccountEntity)
        {
            if (userAccountEntity.GetAccessToken().Equals("refresh"))
            {
                await Auth.RefreshAccessToken(userAccountEntity);
            }
            var param = new Dictionary<String, String>();
            if (!string.IsNullOrEmpty(name)) param.Add("name", name);
            if (!string.IsNullOrEmpty(url)) param.Add("url", url);
            if (!string.IsNullOrEmpty(location)) param.Add("location", location);
            if (!string.IsNullOrEmpty(description)) param.Add("description", description);

            var theAuthClient = new HttpClient();
            HttpContent header = new FormUrlEncodedContent(param);
            var request = new HttpRequestMessage(HttpMethod.Post, EndPoints.ACCOUNT_UPDATE) {Content = header};
            request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", userAccountEntity.GetAccessToken());
            try
            {
                HttpResponseMessage response = await theAuthClient.SendAsync(request);
                return response.IsSuccessStatusCode;
            }
            catch (Exception)
            {
                return false;
            }
        }
Comment

PREVIOUS NEXT
Code Example
Csharp :: char to digit in java 
Csharp :: c# function return 
Csharp :: how c# connection 
Csharp :: c# get total milliseconds from datetime 
Csharp :: nunjucks index in loop 
Csharp :: generate random dark colors programatically in android 
Csharp :: on collision enter by layer 2d unity 
Csharp :: minimize window windows forms application c# 
Csharp :: asp.net mvc image upload 
Csharp :: transform.position.x unity 
Csharp :: How to make game object transparent in unity 
Csharp :: hwo to prevent rotation after hitting an object in unity 
Csharp :: c# get type of class 
Csharp :: c# get list item in random order 
Csharp :: remove multiple items from list c# 
Csharp :: C# setting property values through reflection with attributes 
Csharp :: c# close form 
Csharp :: blazor ref to component in if 
Csharp :: append 2 arrays c# 
Csharp :: c# how to print 
Csharp :: c# implement ienumerable t 
Csharp :: c# directory file 
Csharp :: split lines c# 
Csharp :: .net 6 autofac 
Csharp :: Get Last Access Time Of Directory C# 
Csharp :: c# get assembly directory 
Csharp :: c# combobox lock edit 
Csharp :: Convert Json String to model Class or Object 
Csharp :: c# bool to int 
Csharp :: unity singleton 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =