title: c# web api 2 - any way to wrap all routes for "site is down"?
body: <p>The high level problem I'm trying to solve:</p>
  
  <p>Given our design of<br>
   - c# web api to modify entities and retrieve view models<br>
   - react SPA frontend</p>
  
  <p>I want to be able to conditionally turn the c# web api "off" and tell the SPA the "site is down for maintenance".  The purpose for this is to prevent odd errors in the client in the case someone is using the site during the transition.</p>
  
  <p>The initial idea I had to solve this was to wrap each call in a web.config check to see if the site is down, and if so, return a hard-coded error response which the frontend knows what to do with.  However the cleanest approach I can think of is to inject a service into each web api controller and invoke it at the beginning of each route.  I was instead hoping for a way to avoid this boilerplate.</p>
  
  <p>In node I would decorate all the routes in a wrapper function that does this.  C# is a little more foreign to me.</p>