title: MVC: The model item passed into the dictionary is of type X, but this dictionary requires a model item of type X
body: <p>I am using EF model first and using viewmodels in MVC, I have problems with this error:</p>
  
  <pre><code>The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[NKI3.Models.Question]', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable`1[NKI3.ViewModels.IndexCreateViewModel]'.
  </code></pre>
  
  <p>This is my viewmodel:</p>
  
  <pre><code>public class IndexCreateViewModel
  {
      public string QuestionText { get; set; }
      public string Sname { get; set; }
      public string Cname {get;set;}
  }
  </code></pre>
  
  <p>This is my Action in my controller:</p>
  
  <pre><code>public ActionResult Index()
  {
      var Q = db.Question.Include(a =&gt; a.SubjectType).Include(a =&gt; a.CoreValue);
      return View(Q.ToList());   
  }
  </code></pre>
  
  <p>Here is my strongly typed view:</p>
  
  <pre><code>@model IEnumerable&lt;NKI3.ViewModels.IndexCreateViewModel&gt;
  
  &lt;h2&gt;Index&lt;/h2&gt;
  
  &lt;p&gt;
      @Html.ActionLink("Create New", "Create")
  &lt;/p&gt;
  &lt;table&gt;
      &lt;tr&gt;
          &lt;th&gt;
              QuestionText
          &lt;/th&gt;
          &lt;th&gt;
              Sname
          &lt;/th&gt;
          &lt;th&gt;
              Cname
          &lt;/th&gt;
          &lt;th&gt;&lt;/th&gt;
      &lt;/tr&gt;
  
  @foreach (var item in Model) {
      &lt;tr&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.QuestionText)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.Sname)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.Cname)
          &lt;/td&gt;
  
      &lt;/tr&gt;
  }
  
  &lt;/table&gt;
  </code></pre>
  
  <p>I dont seem to find the solution for this, do I have to return my viewmodel inside the controller action index? Any help is appreciated.</p>
  
  <p>Thanks in advance!</p>
  
  <p>Best Regards!</p>