'How to send my response content to my view on Blazor?
Hi cracks i have a component create and this is how call and send info to controller
var resp = await Http.PostAsJsonAsync<dynamic>($"AddOrdenFabricacionEspecial/{sessionTest.TokenAplicacion}", OrdenEspecial);
and this is my controller
[Route("AddOrdenFabricacionEspecial/{llave}")]
public async Task<dynamic> AddOrdenFabricacionEspecial(OWOR Json, string llave)
{
try
{
var urlBase = config["urlApi:url2"].ToString();
var client = new RestClient(urlBase+"OrdenFabricacion");
var request = new RestRequest(Method.POST);
string json = JsonConvert.SerializeObject(Json);
request.AddHeader("content-type", "application/json");
request.AddHeader("Authorization", "Bearer" + llave);
request.AddParameter("application/json", json, ParameterType.RequestBody);
IRestResponse response = await client.ExecuteAsync(request);
return Ok($"{response.Content}");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
throw;
}
}
i try to read after to response ok in controller , but i really lose in this, i cant obtain the string content from my var Resp
Ty all for read.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
