title: ASP.Net MVC "The model item passed into the dictionary is of type 'System.Collections.Generic.List"
body: <p>View</p>
  
  <pre><code>@using LearningMVCBLL;
  @model LearningMVC.Models.User
  
  @{
      ViewBag.Title = "CityDetails";
  }
  
  &lt;h2&gt;CityDetails&lt;/h2&gt;
  &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;ID&lt;/th&gt;
              &lt;th&gt;Value&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;City Name&lt;/td&gt;
              &lt;td&gt;@foreach (CityMaster city in @Model.GetCityDetails())
                  {
                  @city.City_Name
                  }
              &lt;/td&gt;
          &lt;/tr&gt;
          @* &lt;tr&gt;
        &lt;td&gt;&lt;/td&gt;
        &lt;td&gt;&lt;/td&gt;
      &lt;/tr&gt;*@
      &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.Mvc;
  using LearningMVC.Models;
  using LearningMVCBLL;
  
  namespace LearningMVC.Controllers
  {
      public class UserController : Controller
      {
          //
          // GET: /Index/
  
          public ActionResult CityDetails()
          {
              User User = new User();
              List&lt;CityMaster&gt; city = new List&lt;CityMaster&gt;();
              city = User.GetCityDetails();
              return View(city);
          }
  
      }
  }
  </code></pre>
  
  <p>Model</p>
  
  <pre><code>using LearningMVCBLL;
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  
  namespace LearningMVC.Models
  {
      public class User
      {
          LearningMVCDataContext _dbContext = new LearningMVCDataContext();
          public List&lt;CityMaster&gt; GetCityDetails()
          {
              List&lt;CityMaster&gt; city = _dbContext.CityMasters.Where(c =&gt; c.City_ID == 2).ToList();
              return city;
          }
      }
  
  }
  </code></pre>
  
  <p>I am new to MVC please help me in resolving this problem. Error that I am getting is "The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[LearningMVCBLL.CityMaster]', but this dictionary requires a model item of type 'LearningMVC.Models.User'."</p>
  
  <p>I am using LINQ to fetch the data from the database. Please explain me what I am doing wrong or I am completely wrong.</p>