我有一个 JavaScript 变量,它基本上是一个边界框数组(称为bounds)。每个数组元素的形式为:
{
    XHigh: -71.00742992911023,
    XLow: -71.00670274612378,
    YHigh: 42.09467040703646,
    YLow: 42.09458047487587
}
我正在尝试通过 POST 将其发送到操作方法:
$.ajax({
    url: '/Map/GetLocations',
    type: 'POST',
    data: { boxes: bounds },
    success: function(data) {
        // doing something with the result
    }
});
在服务器上,我将数据消耗到 action 方法中,如下所示:
[HttpPost]
public ActionResult GetLocations(IList<BoundingBox> boxes)
{
    // do something with boxes and return some json
}
DTO 类定义为:
public class BoundingBox
{
    public decimal XHigh { get; set; }
    public decimal XLow { get; set; }
    public decimal YHigh { get; set; }
    public decimal YLow { get; set; }
}
在 action 方法中,该boxes值确实包含我在 POST 中发送的正确数量的元素。但是,所有的十进制值都是 0。我尝试在 DTO 中将它们更改为doubles,仍然是 0.0。我尝试将它们更改为strings 并且它们是空的。
我是否在模型绑定中遗漏了有关如何填充这些值的内容?如何将这个对象数组发送到我的操作方法?