title: call another api controller
body: <p>When I call user controller (api/user), I am able to pass user credentials, however the application crashes with null exception error (<strong>Value cannot be null</strong>) in the values controller:</p>
  
  <pre><code>   public class ValuesController : ApiController
     {
     private cdwEntities db = new cdwEntities();
  
     public HttpResponseMessage Get([FromUri] Query query)
     {
         var data = db.database.AsQueryable();
  
         if (query.name != null)
         {
             data = data.Where(c =&gt; c.Name == query.name);
         }
  
         if (query.price != null)
         {
             data = data.Where(c =&gt; c.Price == query.price);
         }
  
  
         if (!data.Any())
         {
             var message = string.Format("error");
             return Request.CreateErrorResponse(HttpStatusCode.NotFound, message);
         }
  
         ***return Request.CreateResponse(HttpStatusCode.OK, data);***
     }
  
  }
  </code></pre>
  
  <p>I believe this error is because valuescontroller method cannot pass null values as it always pass parameters(i.e. api/values/name=tom), hence when I call user controller, it throws null error because the system has not passed any parameters into the Valuescontroller from user controller. </p>
  
  <pre><code>public class UserController : ApiController
  {
      [Authorize]
      public HttpResponseMessage Get([FromUri] Query query)
      {
          if (User.IsInRole("user"))
          {
              var result = new itemController();
              return result.Get(query);
          }
  
          var message = string.Format("No data was found");
          return Request.CreateErrorResponse(HttpStatusCode.NotFound, message);
      }
  </code></pre>
  
  <p>}</p>
  
  <p>Is their some built-in function i could use to solve this issue or any framework/library i should look into?
  Many thanks for your help and time.</p>