Leveraging the ASP.NET pipeline
REST APIs are based on the HTTP standard. The standard is a protocol standard and will not necessarily reflect in a good way what really happened when you performed an operation.
One way to do this would be to create a common result object that all Web API controller actions need to return. But that would then become one of these recipes that could be forgotten and leave the solution in an inconsistent state.
The idea of having a common result object is undoubtedly desirable, but we should work towards returning it automatically for all Web API calls. However, there is a difference between performing an operation and getting data. Basically, in HTTP, that is what the different verbs are for, HTTP GET represents getting data, while verbs such as POST, PUT, or DELETE represent the operations you want to perform.
These types of operations are typically what you tend to perform as operations on a database in a data-driven application. You’...