title: Self join in LINQ query and return View
body: <p>I am using LINQ Self Join Query to display data on the view .my sql table contains some employees details .I need to show employee details with their Manager Name 
  as it is ManagerID in the table as</p>
  
  <pre>
  EmpID  Name ManagerID   Designation Phone   Address
  1   Mike    3          Developer    123456  Texas
  2   David   3           RM          123456  Delhi
  3   Roger   NULL        GM          123456  Dallas
  4   Marry   2          Developer    123456  NY
  5   Joseph  2          Developer    123456  Singapore
  7   Ben 2              Developer    123456  Mumbai
  8   Steven  3          TL           123456  Banglore
   </pre>
  
  <p>i need to change it to name </p>
  
  <p>my code is in controller action </p>
  
  <pre><code>var emp = from m in t.Employees
            join e1 in t.Employees on m.ManagerID equals e1.EmployeeID
            select new { Id = m.EmployeeID , 
                         Name = m.Name, 
                         Manager = e1.Name , 
                         Designation = m.Designation,
                         Phone =m.Phone ,address = m.Address };
  
  return View(emp.Tolist());
  </code></pre>
  
  <p>and in View </p>
  
  <pre><code>@model IEnumerable &lt;mvc4application.models.employee&gt;
  </code></pre>
  
  <p>but I am getting runtime error</p>
  
  <blockquote>
    <p>The model item passed into the dictionary is of type
    System.Data.Objects.ObjectQuery<code>1[&lt;&gt;f__AnonymousType1</code>6[System.Int32,System.String,
    System.String,System.String,System.Nullable<code>1[System.Int32],System.String]]',
    but this dictionary requires a model item of type
    'System.Collections.Generic.IEnumerable</code>1[Mvc4application.Models.Employee]'.]
    System.Web.Mvc.ViewDataDictionary`1.SetModel(Object value) +405487</p>
  </blockquote>
  
  <p>Off Course i am understanding this because my view is using <code>Mvc4application.Models.Employee type</code> .</p>
  
  <p>As I am not able to cast it to model type .<br></p>
  
  <p>can we use SQL view as model in MVC, so that we can do joining in SQL?</p>