如何将表格数组从客户端传递到 webapi 并将其作为数据集获取

How to pass array of tables from client to webapi and get it as dataset

任何人都知道如何执行以下操作: 客户:

this.editFileAndSave = function (tablesRaw) {
    return $http.put(uploadUrl, {
        params: { newDS: tablesRaw }
    })
}

服务器(网络api):

[HttpPut]
    public HttpResponseMessage SaveFile(DataSet newDS)

当我尝试这个时,它进入了 SaveFile 函数,但为 null。

我需要将数组的数组发送到服务器并在那里将其作为数据集获取。

知道怎么做吗?

您必须以 JSON 的形式发送并以 JSON 的形式获取。 或者如果你想在方法中得到DataSet精确,你必须写Custom Model Binder。 看到这个:Custom Model Binding