I have a Web API project and right my methods always returns HttpResponseMessage.
So, if it works or fails I return:
No errors:
return Request.CreateResponse(HttpStatusCode.OK,"File was processed.");
Any error or fail
return Request.CreateResponse(HttpStatusCode.NoContent, "The file has no content or rows to process.");
When I return an object then I use:
return Request.CreateResponse(HttpStatusCode.OK, user);
I would like to know how can I return to my HTML5 client a better encapsulated respose, so I can return more information about the transaction, etc.
I was thinking on creating a custom class that can encapsulate the HttpResponseMessage but also have more data.
Does anyone have implemented something similar?