I am working with angular 5 and httpClient, and I have to send 2 objects per post parameter but I do not know how to send them or how to receive them the objects are user1 who has 3 fields user2 who has 3 fields
this is the code in my web api in .net
[HttpPost]
public bool actualizarUsuario(Usuario oldUser, Usuario newUser)
{
try
{
return UsuarioNeg.actualizarUsuario(oldUser, oldUser);
}
catch (Exception ex)
{
throw;
}
}
and that's how I'm sending it from my service at angular 5
actualizarUsuario(oldUser:any,newUser:any): Observable<any> {
return this.httpClient.post('www.una-url.com', {'oldUser':oldUser , 'newUser':newUser}, this.header);
}
} This is the header:
this.header = new Headers({ 'Content-Type': 'application/x-www-form-urlencoded', "method": "post" });
Note: Change the url to "www.una-url.cl"