This code returning result
won't compile, as result
doesn't implement IHttpActionResult
...
public <IHttpActionResult> GetItem(Guid id)
{
// ... code ..., Item result = ....
return result;
}
Returning Json()
always returns HTTP 200 and the result in JSON format, no matter what format is in the Accept header of the incoming request.
public <IHttpActionResult> GetItem(Guid id)
{
// ... code ..., Item result = ....
return Json(result);
}
Returning Ok()
returns HTTP 200, but the result will be formatted based on what was specified in the Accept request header.
public <IHttpActionResult> GetItem(Guid id)
{
// ... code ..., Item result = ....
return Ok(result);
}