title: The model item passed into the dictionary is of type 'System.Data.Linq.DataQuery`1[Models.MailListViewModel]'
body: <p>I am getting an error saying:</p>
  
  <blockquote>
    <p>The model item passed into the dictionary is of type 'System.Data.Linq.DataQuery`1[WebUI.Models.MailListViewModel]', but this dictionary requires a model item of type 'WebUI.Models.MailListViewModel'.</p>
  </blockquote>
  
  <p>This is in my controller:</p>
  
  <pre><code>public ViewResult List()
      { var mailToShow = from m in mailRepository.Mail
                           join p in profilesRepository.Profiles on m.SenderId equals p.ProfileId 
                           select new MailListViewModel
                                      {
                                          SenderId = m.SenderId,
                                          ProfileId = p.ProfileId,
                                          UserName = p.UserName,
                                          Subject = m.Subject
                                      }; 
         return View(mailToShow);
      }
  </code></pre>
  
  <p>This is in my MailListViewModel:</p>
  
  <pre><code>public class MailListViewModel
  {        
      public int SenderId;
      public int ProfileId;
      public string UserName;
      public string Subject;
  }
  </code></pre>
  
  <p>This is in my view:</p>
  
  <pre><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage&lt;WebUI.Models.MailListViewModel&gt;" %&gt;
  
  &lt;% foreach (var m in (IEnumerable)Model)
         { %&gt;
      &lt;tr&gt;
          &lt;td&gt;
          &lt;/td&gt;
          &lt;td&gt;TODO image&lt;/td&gt;   
          &lt;td&gt;
          &lt;%: Model.SenderId %&gt;&lt;/td&gt;
  
          &lt;td&gt;&lt;%: Model.Subject%&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;% } %&gt;
  </code></pre>
  
  <p>The error message seems to be conflicting, saying that I am using the correct model.</p>
  
  <p>What should I do?</p>