I am trying to do a PUT Api call and and passing through a object. In the front end, when I console.log the object before performing the API call, it reads the value just fine...
However, when it reaches the breakpoint in the .Net Core controller, the value is always null, no matter what I try.
Angular/Client Side
public edit(message) {
console.log(message);
this.$http.put(`api/causemessage`, message).then((res) => {
this.$state.reload();
});
}
.Net Core Controller
[HttpPut]
public void Put([FromBody] CauseMessage msg)
{
_service.EditCauseMessage(msg);
//TODO : Get the PUT to get the correct data from the client side. Client side "should" be sending the
//TODO : correct data already.
}
^ msg seems to always be null even though before the api call in the client, the log shows it filled with data.
Developers Tools - Console Log
Object {id: 1004, message: "Testing123", messageDate: "Today", causeId: "d5a93ae4-f248-439a-9425-8be7746591fc", $$hashKey: "object:15"}
$$hashKey
:
"object:15"
causeId
:
"d5a93ae4-f248-439a-9425-8be7746591fc"
id
:
1004
message
:
"Testing123"
messageDate
:
"Today"
If anyone can help me find out why I'm always receiving a null value, that would be great.