这是我的API控制器。 customfiltervalues为null:
[HttpPost]
[Route("api/ajaxapi/customfilters")]
public List<CustomCaseValues> CustomFilters(List<CustomFilterValues> customfiltervalues)
{
这是我的数据:
var customfiltervalues =[
{
TableName: $('#tableOneTableName').val(),
ColumnName: $('#tableOneColumnName').val(),
Condition: $('#tableOneCondition').val(),
TextBox: $('#tableOneTextBox').val(),
Operator: $('#tableOneOperator').val()
},
{
TableName: $('#tableTwoTableName').val(),
ColumnName: $('#tableTwoColumnName').val(),
Condition: $('#tableTwoCondition').val(),
TextBox: $('#tableTwoTextBox').val(),
Operator: $('#tableTwoOperator').val()
},
{
TableName: $('#tableThreeTableName').val(),
ColumnName: $('#tableThreeColumnName').val(),
Condition: $('#tableThreeCondition').val(),
TextBox: $('#tableThreeTextBox').val(),
Operator: $('#tableThreeOperator').val()
}
];
这是我的Ajax电话:
$.ajax({
traditional: true,
type: "POST",
url: domainName + "api/ajaxapi/customfilters",
data: JSON.stringify(customfiltervalues),
beforeSend: function (request) {
request.setRequestHeader("Authorization", getCookie("Token"));
},
success: function (response) {}
这是我的班级:
public class CustomFilterValues
{
public string TableName { get; set; }
public string ColumnName { get; set; }
public string Condition { get; set; }
public string TextBox { get; set; }
public string Operator { get; set; }
}