Hello All ----
How can I return my return await response.StatusCode;?
Here is the code....
How can I return my return await response.StatusCode;?
Here is the code....
C#:
public async Task<IRestResponse> HitAPI(JsonData jsonSend) {
var client = new RestClient("");
var request = new RestRequest("", Method.Post);
request.AddParameter("application/json; charset=utf-8", jsonSend, ParameterType.RequestBody);
request.RequestFormat = DataFormat.Json;
client.ExecuteAsync(request, response =>
{
if (response.StatusCode == System.Net.HttpStatusCode.Ok)
{
//it work
}
else
{
//no work
}
});
return await response.StatusCode;
}
Last edited by a moderator: