title: MVC - The model item passed into the dictionary is of type.. but this dictionary requires a model item of type
body: <p>I cannot understand why I have this error because what I'm trying to do should be fairly simple:</p>
  
  <blockquote>
    <p>The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[Interface.Models.UserAccount]', but this dictionary requires a model item of type 'Interface.Models.UserAccount'. </p>
  </blockquote>
  
  <p>Index.cshtml</p>
  
  <pre><code>@model Interface.Models.UserAccount
  
  @{
      ViewBag.Title = "Home Page";
  }
  
  &lt;h2&gt;Register&lt;/h2&gt;
  
  @using (Html.BeginForm())
  {
  @Html.AntiForgeryToken()
  
  &lt;div class="form-horizontal"&gt;
      &lt;h4&gt;Create an Account&lt;/h4&gt;
      &lt;hr /&gt;
      @Html.ValidationSummary(true, "", new { @class = "text-danger" })
      &lt;div class="form-group"&gt;
          @Html.LabelFor(model =&gt; model.FirstName, htmlAttributes: new { @class = "control-label col-md-2" })
          &lt;div class="col-md-10"&gt;
              @Html.EditorFor(model =&gt; model.FirstName, new { htmlAttributes = new { @class = "form-control" } })
              @Html.ValidationMessageFor(model =&gt; model.FirstName, "", new { @class = "text-danger" })
          &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>HomeController.cs</p>
  
  <pre><code>namespace Interface.Controllers
  {
      public class HomeController : Controller
      {
          // GET: Account
          public ActionResult Index()
          {
          SqlConnection con = new      SqlConnection(ConfigurationManager.ConnectionStrings["MyDB"].ConnectionString);
              MyDB db = new MyDB();
              {
              return View(db.userAccount.ToList());
              }
           }
           [HttpPost]
           public ActionResult Index(UserAccount account)
           {
          if (ModelState.IsValid)
          {
              MyDB db = new MyDB();
              {
                  db.userAccount.Add(account);
                  db.SaveChanges();
              }
              ModelState.Clear();
              ViewBag.Message = account.FirstName + " " + account.LastName + "successfully registered.";
          }
          return View();
      }
  </code></pre>
  
  <p>The original /Home/Index page was redundant for my application, so what I was trying to do was replace /Account/Register so that /Account/Register is actually just /Home/Index.</p>
  
  <p>The problem lies where it is returning items which were part of a view before, and it doesn't like it.</p>
  
  <p>How can I amend so that this page loads correctly? I see a lot of similar results, but they have IEnumerable within their code when I don't</p>