Clean up your Web API controllers with model validation and null check filters
Because filters are your friends
Regardless of what kind of applications you build with Web API, you are bound to write a lot of similar code in many of your actions – to check if the model is valid and to check if the submitted object is null.
This creates unnecessary noise and repetition. In this short blog post, let’s have a quick at how you can delegate this kind of repetitive logic to Web API filters.
More after the jump.