2
I have this code on Web Api
:
[ResponseType(typeof(Menu))]
public async Task<IHttpActionResult> PostMenu(Menu menu)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
db.Menus.Add(menu);
await db.SaveChangesAsync();
return CreatedAtRoute("DefaultApi", new { id = menu.Id }, menu);
}
In the Controller
of a project Asp.net MVC
I get the answer so:
var response = await client.PostAsJsonAsync("api/menus", menu);
How to get Id in Sponse?
Thank you.