c# mvc Controller中无法接收list类型的数据
后端Controller中接收方法如下:
[HttpPost]
public HttpResponseMessage BatchDoDistribute([FromBody]List<DistributeMaterial> list){
}
通过postman测试后发现,list能够接收到两个对象,但是对象的具体属性值却一个都没有接收到。如下图:
使用postman进行post接口测试,数据格式是:application/json,测试数据如下:
[{
"StageName": "测试名称1",
"ContainerID": "999",
"ContainerTypeCode": "999",
"ProduceOrderNO": "WH18060041",
"OriginMaterialCode": "120400000009",
"LastModifyPerson": "自动登录用户",
"Location": "Cell-2-05-02",
"MaterialInventoryCode": "120400000009",
"IsSubstitutie": 0,
"TotalNeedDistribute": 66.0,
"ContainerCapacity": 20.0,
"Quantity": 66.0,
"ID": 0,
"IsDispatch": 0,
"ProduceLineStationID": 0,
"ProduceLineID": 0,
"WorkstageID": 24
},{
"StageName": "测试名称2",
"ContainerID": "999",
"ContainerTypeCode": "999",
"ProduceOrderNO": "WH18060041",
"OriginMaterialCode": "120400000009",
"LastModifyPerson": "自动登录用户",
"Location": "Cell-2-05-02",
"MaterialInventoryCode": "120400000009",
"IsSubstitutie": 0,
"TotalNeedDistribute": 66.0,
"ContainerCapacity": 20.0,
"Quantity": 66.0,
"ID": 0,
"IsDispatch": 0,
"ProduceLineStationID": 0,
"ProduceLineID": 0,
"WorkstageID": 24
}]
请问如何才能接收到呢?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
字段名称不一致导致的吧?