I am trying to pass an array of int but I can not get the value in the webapi method
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
});
and in apiController :
[HttpDelete]
public bool DeleteModel(int[] deletedIds)
{
return modelsRepository.DeleteModels(deletedIds);
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…