我正在尝试传递一个 int 数组,但我无法在 webapi 方法中获取值
var postData = { "deletedIds": deletedIds };
$.ajax({
type: "DELETE",
traditional: true,
dataType: 'json',
contentType: 'application/json',
cache: false,
url: "/api/Management/Models",
data: JSON.stringify(postData),
success: ModelDeleted,
error: ModelNotDeleted
});
在 apiController 中:
[HttpDelete]
public bool DeleteModel(int[] deletedIds)
{
return modelsRepository.DeleteModels(deletedIds);
}