I have the following method in my Controller
:
public IHttpActionResult Get(string id)
{
var product = objds.GetProduct(new ObjectId(id));
if (product == null)
{
return NotFound();
}
return Ok(product);
}
If the product is null
then return a 404
, otherwise return a OK
with the product. My doubts are as follows:
- How can I return a message along with the status
404
? - Are you having trouble returning a message along with
status
?