title: Ninject binding based on http method (GET or POST)
body: <p>I am using <code>Ninject</code> to bind service classes using constructor injection.</p>
  
  <p>My problem is:</p>
  
  <p>I have a class (controller) <code>User</code>, which takes interface <code>IService</code> in the constructor.</p>
  
  <p><code>IService</code> is implemented by <code>UowService</code> and <code>ReadonlyService</code>.</p>
  
  <p>Now, I want to inject <code>ReadonlyService</code>, if the web request is a <code>GET</code>. But <code>UowService</code> for <code>POST</code>. Also, it should only configure for class <code>User</code>, meaning this binding should not affect any other class.</p>
  
  <p>I know I can bind for <code>User</code> like this:</p>
  
  <pre><code>kernel.Bind&lt;IService&gt;().To&lt;ReadonlyService&gt;().WhenInjectedInto&lt;User&gt;()
  </code></pre>
  
  <p>And, following can be used to bind according to http method</p>
  
  <pre><code>kernel.Bind&lt;IService&gt;().ToMethod(ctx =&gt; 
  {
      var verb = HttpContext.Current..HttpMethod;
      if (verb == "GET")
      {
          return kernel.Get&lt;ReadonlyService&gt;();
      }
  
      return kernel.Get&lt;IService&gt;();
  });
  </code></pre>
  
  <p>But how to combine both conditions? Also, is there any better and straightforward way to do so?</p>