title: Error: The entity or complex type cannot be constructed in a LINQ to Entities query
body: <p>I get this error "System.NotSupportedException: The entity or complex type 'MyModel.Team' cannot be constructed in a LINQ to Entities query." when I navigate to the Team/Index/{id} page. Can someone point me to the mistake I did please?</p>
  
  <p>Controller:</p>
  
  <pre><code>public ActionResult Index(int id)
      {
          IQueryable&lt;Team&gt; teams = teamRepository.GetTeamByPersonID(id);   
          return View("Index", teams);
      }
  </code></pre>
  
  <p>Repository:</p>
  
  <pre><code>public IQueryable&lt;Team&gt; GetTeamByPersonID(int id)
      {
          return from t in entities.Teams
                 join d in entities.Departments
                  on t.TeamID equals d.TeamID
                 where (from p in entities.Person_Departments
                        join dep in entities.Departments
                        on p.DepartmentID equals dep.DepartmentID
                        where p.PersonID == id
                        select dep.TeamID).Contains(d.TeamID)
                 select new Team
                 {
                     TeamID = t.TeamID,
                     FullName = t.FullName,
                     ShortName = t.ShortName,
                     Iso5 = t.Iso5,
                     DateEstablished = t.DateEstablished,
                     City = t.City,
                     CountryID = t.CountryID
                 };
      }
  </code></pre>
  
  <p>ViewModel:</p>
  
  <pre><code>public IQueryable&lt;Team&gt; teamList { get; set; }
  public TeamViewModel(IQueryable&lt;Team&gt; teams)
      {
           teamList = teams;
      }
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>&lt;% foreach (var team in Model){ %&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;%: Html.ActionLink(team.ShortName, "Details", new { id=team.TeamID}) %&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%: team.City %&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%: team.Country %&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;% } %&gt;
  </code></pre>