My API has an [HttpPatch] action which i need to invoke.
[HttpPatch("{id}")]
public StatusCodeResult Patch(int id, [FromBody]JsonPatchDocument<Reservation> patch)
{
Reservation res = Get(id);
if (res != null)
{
patch.ApplyTo(res);
return Ok();
}
return NotFound();
}
I am trying it from HttpClient class but it does not have .PatchAsync()
method?
Also the parameter is of type JsonPatchDocument<Reservation>
and so how to send it from client when invoking this action?
Please help
You have to create an
HttpRequestMessage
manually and send it viaSendAsync
: