Hi @Prathamesh Shende ,
Update
You should use HttpClient client = new HttpClient();
, not return await HttpClient.GetFromJsonAsync<Deal>($"{HttpClient.BaseAddress}api/deals/updatestage?dealid={dealID}&stageId={stageID}");
.
[JSInvokable]
public static async Task<String> BackendCode(string dealID)
{
var request = new HttpRequestMessage(HttpMethod.Get,
"http://localhost:44366/counter/testapi");
HttpClient client = new HttpClient();
var response = await client.GetAsync($"your_api_url");
if (response.IsSuccessStatusCode)
{
return await response.Content.ReadAsStringAsync();
}
else
{
return "Request Failed ";
}
}
You should add static
in your method, it works for me. Like below :
public static async Task<Deal> UpdateDealsStageAsync(int dealID, int stageID).
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best Regards,
Jason