如何传递超过10个参数查询字符串的一部分,我的asp.net网页API 2.如何查询字符串参数传递给asp.net网页API 2
这是我的asp.net网页API 2方法,我无法弄清楚,我怎么能装点这个方法,让它接受ID和一个复杂的类型,是CustomerRequest,我想使用网址类似
http://localhost/api/Customer/?Mobile0012565987&Email=abcxyz.com&IsEmailVerified=true
[ResponseType(typeof(Customer))]
public IHttpActionResult GetCustomer(long id, [FromUri]CustomerRequest request)
{
var customer = db.Customers.Find(request.CustomerId);
if (customer == null)
{
return NotFound();
}
return Ok(customer);
}
这是
public class CustomerRequest
{
public string Mobile { get; set; }
public string Email { get; set; }
public Nullable<bool> IsEmailVerified { get; set; }
}
否则pleaase指导我,如果有更好的方式来做到这一点CustomerRequest类。
感谢
你能告诉你的路由表? –