How am I retrieving data from my Web api , into my MVC application ?
I've got a simple CRUD web api that have a GetItem
method.
here it is :
// GET api/UserAwesome/5
public Item GetItem(int id)
{
Item item = db.Items.Find(id);
if (item == null)
{
throw new HttpResponseException(
Request.CreateResponse(HttpStatusCode.NotFound));
}
return item;
}
When I run in my browser http://localhost:32120/api/UserAwesome/1
, everything is fine and cool, I get the information ..
but how am I retrieve it in my MVC application ?
I've got this ActionResult
:
public ActionResult UserDetails(int userId)
{
return View();
}
what should I place there?