Angular JS MVC Web API Model/ Parameter not binding .NET Core

前端 未结 3 1231
执念已碎
执念已碎 2021-01-12 17:08

I am using Angular JS with TypeScript and ASP.NET Core MVC/API.

I have an apiService which deals with all POST and GET reques

3条回答
  •  孤街浪徒
    2021-01-12 17:22

    You sent { companyId: selectedCompany.id } which is an object with has a field companyId that has the value selectedCompany.id;

    Either switch to a GET request as said answer or create a wrapper class having one integer field companyId and use it as input to your function on server-side.

    Other thing you can try :

    • send only the integer instead of an object
    • send the integer as string, the negine may parse it as an int.

提交回复
热议问题