我收到以下错误,当JQuery的排序叫我的行动类别:jQuery的排序和MVC停止工作
参数字典包含参数无效输入“DonationIDS”的方法“System.Web.Mvc.EmptyResult SortDonations (System.Collections.Generic.List 1[System.Int32])' in 'Vol.Web.Areas.ActivityArea.Controllers.DonationController'. The dictionary contains a value of type 'System.Collections.Generic.List
1 [Vol.Models.Token]',但该参数需要类型'System.Collections.Generic.List`1 [System.Int32]'的值。
参数名称:参数
的jQuery:
$("#dlist").sortable({
handle: '.sorthandle',
update: function() {
var order = $('#dlist').sortable('toArray');
$.ajax({
url: '/activity/donation/sortdonations',
data: { DonationIDS: order },
type: 'POST',
traditional: true
});
}
});
提交值:
Parametersapplication/x-www-form-urlencoded
DonationIDS 1
DonationIDS 8
Source
DonationIDS=1&DonationIDS=8
MVC操作:
public EmptyResult SortDonations(List<int> DonationIDS)
{
int order = 0;
foreach (int i in DonationIDS)
{
donationRepository.UpdateSortOrder(i, order);
order++;
}
return new EmptyResult();
}
这是工作完美,但现在看来引用另一个类,令牌。任何想法正在发生什么或从哪里开始寻找?