复杂的post参数始终为null

Sef*_*efa 1 c# asp.net-web-api

当我向后续行动发出请求时

[HttpPost]
public ResponseOutput Incremental(List<Product> inputList)
{
    return true;
}
Run Code Online (Sandbox Code Playgroud)

参数inputList始终为null.我的目标:

public class Product
{
    public string ContractNo { get; set; }
    public string Sku { get; set; }
    public double Alis { get; set; }
    public string Kur { get; set; }
    public string SupplierNumber { get; set; }
    public ActionType Islem { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

ActionType是枚举.

我的要求机构:

POST /api/Konsinye/ConsigneeInsertIncremental HTTP/1.1
Host: localhost:38664
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: 9e5f759c-552d-2e3e-f704-28ec91045e6c

{
 "inputList" : [
    {
      "ContractNo" : "123",
      "Sku" : "1234",
      "Alis" : "112",
      "Kur" : "TRY",
      "SupplierNumber" : "000",
      "Islem" : "1"
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)

问题是,参数始终为null.我尝试将[FromBody]添加到签名但它没有帮助.

Sla*_*nov 5

尝试这种方法(将对象数组传输到服务器而不是具有数组属性的单个对象):

[HttpPost]
public IHttpActionResult Incremental(List<ConsigneeProductInput> data)
{
    return Ok();
}
Run Code Online (Sandbox Code Playgroud)

邮递员的身体:

[
    {
      "ContractNo" : "123",
      "Sku" : "1234",
      "Alis" : "112",
      "Kur" : "TRY",
      "SupplierNumber" : "000",
      "Islem" : "1"
    }
]
Run Code Online (Sandbox Code Playgroud)