更新时间:2023-02-16 14:02:27
根据您的代码,您还需要传递"id",如下所示:
Based on your code, you need to pass 'id' as well, like this:
http://localhost/api/Customer/?id=12345&Mobile=0012565987&Email=abcxyz.com&IsEmailVerified=true
如果要使"id"为可选,则可以使方法签名看起来像这样:
if you want to make 'id' optional, you can make your method signature look like this:
public IHttpActionResult GetCustomer([FromUri]CustomerRequest request, long id = 0)
如果未在URL中传递ID,则默认情况下会将ID设置为0.这样您就可以像最初一样访问您的URL:
this will set id to 0 by default, if you dont pass it in the URL. So you will be able to access your URL like you originally did:
http://localhost/api/Customer/? Mobile = 0012565987& Email = abcxyz.com& IsEmailVerified = true