title: ASP.Net MVC Web API Return list of objects
body: <p>How do I correctly return a list of "CarTypes" objects (from the second method), where the TyreID that is passed in, is not the primary key of the CarType class - so for example, I want to return a list of all CarTypes, where the TyreID is 5:</p>
  
  <pre><code>// GET api/CarTypes
  public IEnumerable&lt;CarTypes&gt; GetCarTypes()
  {
      return db.CarTypes.AsEnumerable();  //This works fineCar
  }
  
  // GET api/CarTypes/5
  public IEnumerable&lt;CarTypes&gt; GetCarTypes(long id)
  {
      CarTypes cartypes = db.CarTypes.Select(t =&gt; t.TyreID == id).AsEnumerable();
      if (roomtypes == null)
      {
          throw new HttpResponseException(Request
              .CreateResponse(HttpStatusCode.NotFound));
      }
  
      return cartypes;
  }
  </code></pre>
  
  <p>It currently shows the error:</p>
  
  <p>Cannot implicitly convert type 'System.Collections.Generic.IEnumerable' to 'MvcApplication4.Models.CarTypes'. An explicit conversion exists (are you missing a cast?)</p>
  
  <p>And does it matter if I use Select/SelectMany/Where in the query?</p>