如何在函数中将请求内容解析为强类型?

How to parse request content to strong type in function?

我可以像这样将请求内容解析为强类型:

[HttpPost]
public HttpResponseMessage API_Notify(NotifyModel notify)
{
    .
    .
    .
    .
}

但是如何在函数中解析它呢?像这样:

[HttpPost]
public HttpResponseMessage API_Notify()
{
    .
    .
    NotifyModel notify = ToModelMethod<NotifyModel>(Request.Content)
    .
    .
}

试试这个:

var contentJson = await Request.Content.ReadAsStringAsync();
NotifyModel notify = JsonConvert.Deserialize<NotifyModel >(contentJson );