public IActionResult MoedaTurismo()
{
try
{
RestClient restClient = new RestClient();
RestRequest restRequest = new RestRequest();
restRequest.AddHeader("cache-control", "no-cache");
restRequest.AddHeader("content-Type", "application/json");
restClient.BaseUrl = new Uri("http://economia.awesomeapi.com.br/USD-BRLT/1");
var response = restClient.Execute(restRequest);
if (response.StatusCode == HttpStatusCode.OK)
{
var json = response.Content;
var Moeda = JsonConvert.DeserializeObject(json);
return (object);
}
return NotFound();
}
catch (Exception ex)
{
return StatusCode((int)HttpStatusCode.InternalServerError);
}
}
I want to convert Json to C #, is this correct?