我将此控制器用于 .net 核心
string url = "Url Here";
private string customerApi;
private object JsonRequestBehavior;
[HttpGet]
[Route("Getagent")]
public async Task<ActionResult> Getagent(string search)
{
using (var client = new HttpClient())
{
client.BaseAddress = new Uri(url);
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage response = await client.GetAsync(customerApi);
if (response.IsSuccessStatusCode)
{
string jsondata = await response.Content.ReadAsStringAsync();
return Content(jsondata, "application/json");
}
return Ok();
}
}
将值输出为数组 >> 我如何通过 Api 控制器 Web Api 在此数组中进行搜索
浮云间
相关分类