httpclient 没有向 webapi 发送正确的号码

httpclient doesn't send correct number to webapi

我使用angular httpclient向asp.net核心webapi发送数据,数据是personcontact,其中有contact_value、media、person_ID、person_contact_ID .. 这些数据。在 webapi 上,我可以正确接收字符串数据(contact_value,媒体..),但是,对于 int 数据,我收到一些 0x0000ce6 或 0x000.. 一些数据(这不是我想要的..),可以请告诉我如何在 webapi 中正确接收 person_ID 和 person_contact_ID .. 这些 int/number 数据?

tableelement.ts

confirmEditCreate_AddPerson(): boolean {
    //_personService: TestRDB2Service;
    if (this.id == -1)
      return this.source.confirmCreate(this);
    else
      
      try {
        this._http.put("https://localhost:5001/" + 'api/TestRDB2/AddUpdatePerson_Contact/', this.originalData).subscribe();      
      } catch (e) {
        return e
      }
    return true;
      //return this.source.confirmEdit(this);
  }

Testcontact.Controllers

        [HttpPut]
        [Route("AddUpdatePerson_Contact")]
        public int AddUpdatePerson_Contact([FromBody] personcontact personcontact)
        {
            return objtestRDB2.AddUpdatePerson_Contacts(personcontact);
        }

并不是说它们是其他值。可能你的 IDE 即我想你使用的 visual studio 将 int 值显示为 hexademical

如果是这种情况,请检查this answer如何更正显示值

看来你的代码没有问题。您只需要通过右键单击它来禁用十六进制显示。