title: How do you use a linq to sql join two tables and return the result?
body: <p>I have been looking on Stack overflow but none of the answers seem to fully sort out this problem. The error I'm getting is:</p>
  
  <p>Cannot initialize type 'mvcTest.Models.MakeModelSpec' with a collection initializer because it does not implement 'System.Collections.IEnumerable'</p>
  
  <p>I have created a new type like this to get over the anonymous type error</p>
  
  <pre><code>public class MakeModelSpec 
  {
      public int MakeId { get; set; }
      public string Name { get; set; }
  } 
  
  public IQueryable&lt;MakeModelSpec&gt; GetSpecs(int makeid)
          {
  
              var searchspec = from spec in db.Specs
                               join model in db.Models on spec.ModelID equals model.ModelID
                               join make in db.Makes on model.MakeID equals make.MakeId
                               select new MakeModelSpec
                               {
                                   make.MakeId,
                                   spec.Name,
                               };
  
          if (makeid != -1)
          {
              searchspec = searchspec.Where(make =&gt; make.MakeId == makeid);
          }
          return searchspec;
  }
  </code></pre>
  
  <p>If anyone can point me in the right direction, I would be very grateful I'm using MVC c# and a sql server db</p>