【发布时间】:2019-06-12 00:58:12
【问题描述】:
是否可以将查询字符串和模型对象从 angular 传递到 webapi?我的第一个参数总是被填充,但模型参数为空,即使我看到请求有效负载中的所有数据。
我的模型
public Class Person
{
public string Name {get; set;}
public DateTime date {get; set;}
}
我的 API 方法
[Route("MyRoute/")]
[HttpPost]
public DataSourceResult DataResult([ModelBinder(typeof(WebApiDataSourceRequestModelBinder))]DataSourceRequest request, Person model)
{
}
我的查询字符串
http://localhost:60655/api/DataInput/DataResult/?page=1&pageSize=22
请求负载
model: {name: "Time", date: "2014-12-18T18:35:52.087Z"…}
我的帖子调用
const queryStr = `${toDataSourceRequestString(state)}`;
const ComplexObj = {
model: model,
};
const url = this._srvrUrl + apiRoute;
return this._http
.post(`${url}?${queryStr}`, ComplexObj)
【问题讨论】:
标签: angular asp.net-web-api kendo-ui