当我发送Guids集合时,我一直收到错误
The value 'System.Collections.Generic.List`1[System.Guid]' is not valid for Guid.
我认为这是因为restsharp不处理集合,基本上只是把它变成一个字符串。
var ids = checkedItems.Select(x => x.Items).ToList();
var request = new RestRequest("default/Delete", Method.DELETE);
for (int i = 0; i < ids.Count(); i++)
{
request.AddParameter("Ids" + i, ids[i]);
}
这个结果没有约束力
var ids = checkedItems.Select(x => x.Items);
var request = new RestRequest(“default / Delete”,Method.DELETE); request.AddParameter(“ids”,ids);
导致“无效guid”错误。
[HttpDelete]
public HttpResponseMessage Delete([FromUri]DeleteVm vm)
{
}
public class DeleteVm
{
public IEnumerable<Guid> Ids { get; set; }
}