I have this code in 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 Controller
of a project Asp.net MVC
I get the answer like this:
var response = await client.PostAsJsonAsync("api/menus", menu);
How to get the ID no response?
Thank you.