I Post
a new Waste
entity using the following code:
var result = await httpClient.PostAsJsonAsync(wasteApiRoute, waste);
The Api Controller (using the code created by VS) seems to try to make life easy for me by sending back the new Id of the Waste
entity using:
return CreatedAtAction("GetWaste", new { id = waste.Id }, waste);
So the result
variable wil contain this data. Indeed, I find it in its Headers.Location
property as an url.
But how do I nicely extract the Id property from the result without resorting to regular expressions and the like? Surely the creators of ASP.Net Core will have included a nifty call for that?