httpclient doesn't send correct number to webapi

Viewed 43

enter image description here

enter image description here

I use angular httpclient to send data to asp.net core webapi, the data is personcontact which has contact_value, media, person_ID, person_contact_ID.. these data. On webapi, I can receive the string data(contact_value, media..) correctly, however, for the int data, I receive some 0x0000ce6 or 0x000.. something data(which is not I want..), could you please tell me how I can receive person_ID and person_contact_ID .. these int/number data correctly in webapi?

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);
        }
2 Answers

It is not that they are other values. Probably your IDE namely I suppose visual studio that you use is showing the int values as hexademical values

If that is the case check this answer on how to correct the displayed values

It seems that there is nothing wrong with your code. You just need to disable the Hexadecimal Display by right clicking in it.

enter image description here

Related