title: The model item passed into the ViewDataDictionary is of type '*',but this ViewDataDictionary instance requires a model item of type '..IEnumerable[*]'
body: <p>I looked at and implemented solutions on similar topics, but unfortunately they did not provide a solution for me.</p>
  <p>Error Message:</p>
  <blockquote>
  <p>InvalidOperationException: The model item passed into the ViewDataDictionary is of type 'CMS.Models.Page', but this ViewDataDictionary instance requires a model item of type 'System.Collections.Generic.IEnumerable`1[CMS.Models.Page]'.</p>
  </blockquote>
  <p>I'm working on a simple cms. My goal here is to make some changes to them after I have listed my pages.</p>
  <p>I have been trying to fix the error for a while, but I could not get any results from the solutions I applied. My guess is a data communication problem about the model structure here. Below my codes:</p>
  <p>HomeController:</p>
  <pre><code>    public class HomeController : Controller
  {
  
      private readonly ApplicationDbContext _dbContext;
  
      public HomeController(ApplicationDbContext dbContext)
      {
          _dbContext = dbContext;
      }
  
      public IActionResult Index()
      {
          var page = _dbContext.Pages.FirstOrDefault(x =&gt; x.Title == &quot;Home&quot;);
          return View(page);
      }
  
  
      [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
      public IActionResult Error()
      {
          return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
      }
  }
  </code></pre>
  <p>AdminController:</p>
  <pre><code>public class AdminController : Controller
  {
      private readonly ApplicationDbContext _context;
  
      public AdminController(ApplicationDbContext context)
      {
          _context = context;
      }
  
      // GET: Pages
      public async Task&lt;IActionResult&gt; Index()
      {
          return View(await _context.Pages.ToListAsync());
      }
  
      public async Task&lt;IActionResult&gt; EditPage(string title)
      {
          // SELECT * FROM Pages WHERE Title = {title}
          var page = await _context.Pages.FirstOrDefaultAsync(x =&gt; x.Title == title);
  
          if (page == null)
          {
              page = new Page();
              page.Title = title;
  
              _context.Pages.Add(page);
              _context.SaveChanges();
          }
          return View(page);
      }
  
      // GET: Pages/Details/5
      public async Task&lt;IActionResult&gt; Details(int? id)
      {
          if (id == null)
          {
              return NotFound();
          }
  
          var page = await _context.Pages
              .FirstOrDefaultAsync(m =&gt; m.ID == id);
          if (page == null)
          {
              return NotFound();
          }
  
          return View(page);
      }
  
      // GET: Pages/Create
      public IActionResult Create()
      {
          return View();
      }
  
      // POST: Pages/Create
      // To protect from overposting attacks, enable the specific properties you want to bind to, for 
      // more details, see http://go.microsoft.com/fwlink/?LinkId=317598.
      [HttpPost]
      [ValidateAntiForgeryToken]
      public async Task&lt;IActionResult&gt; Create([Bind(&quot;ID,Title,Content,Section&quot;)] Page page)
      {
          if (ModelState.IsValid)
          {
              _context.Add(page);
              await _context.SaveChangesAsync();
              return RedirectToAction(nameof(Index));
          }
          return View(page);
      }
  
      // GET: Pages/Edit/5
      public async Task&lt;IActionResult&gt; Edit(int? id)
      {
          if (id == null)
          {
              return NotFound();
          }
  
          var page = await _context.Pages.FindAsync(id);
          if (page == null)
          {
              return NotFound();
          }
          return View(page);
      }
  
      // POST: Pages/Edit/5
      // To protect from overposting attacks, enable the specific properties you want to bind to, for 
      // more details, see http://go.microsoft.com/fwlink/?LinkId=317598.
      [HttpPost]
      [ValidateAntiForgeryToken]
      public async Task&lt;IActionResult&gt; Edit(int id, [Bind(&quot;ID,Title,Content,Section&quot;)] Page page)
      {
          if (id != page.ID)
          {
              return NotFound();
          }
  
          if (ModelState.IsValid)
          {
              try
              {
                  _context.Update(page);
                  await _context.SaveChangesAsync();
              }
              catch (DbUpdateConcurrencyException)
              {
                  if (!PageExists(page.ID))
                  {
                      return NotFound();
                  }
                  else
                  {
                      throw;
                  }
              }
              return RedirectToAction(nameof(Index));
          }
          return View(page);
      }
  
      // GET: Pages/Delete/5
      public async Task&lt;IActionResult&gt; Delete(int? id)
      {
          if (id == null)
          {
              return NotFound();
          }
  
          var page = await _context.Pages
              .FirstOrDefaultAsync(m =&gt; m.ID == id);
          if (page == null)
          {
              return NotFound();
          }
  
          return View(page);
      }
  
      // POST: Pages/Delete/5
      [HttpPost, ActionName(&quot;Delete&quot;)]
      [ValidateAntiForgeryToken]
      public async Task&lt;IActionResult&gt; DeleteConfirmed(int id)
      {
          var page = await _context.Pages.FindAsync(id);
          _context.Pages.Remove(page);
          await _context.SaveChangesAsync();
          return RedirectToAction(nameof(Index));
      }
  
      private bool PageExists(int id)
      {
          return _context.Pages.Any(e =&gt; e.ID == id);
      }
  }
  </code></pre>
  <p>Page that i can't view =&gt; EditPage:</p>
  <pre><code>@model IEnumerable&lt;piktusCMS.Models.Page&gt;
  
  @{
      ViewData[&quot;Title&quot;] = &quot;Edit Page&quot;;
      Layout = &quot;~/Views/Shared/_Layout.cshtml&quot;;
  }
  
  &lt;h1&gt;Index&lt;/h1&gt;
  
  &lt;p&gt;
      &lt;a asp-action=&quot;Create&quot;&gt;Create New&lt;/a&gt;
  &lt;/p&gt;
  &lt;table class=&quot;table&quot;&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;
                  @Html.DisplayNameFor(model =&gt; model.Title)
              &lt;/th&gt;
              &lt;th&gt;
                  @Html.DisplayNameFor(model =&gt; model.Content)
              &lt;/th&gt;
              &lt;th&gt;
                  @Html.DisplayNameFor(model =&gt; model.Section)
              &lt;/th&gt;
              &lt;th&gt;&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          @foreach (var item in Model) {
          &lt;tr&gt;
              &lt;td&gt;
                  @Html.DisplayFor(modelItem =&gt; item.Title)
              &lt;/td&gt;
              &lt;td&gt;
                  @Html.DisplayFor(modelItem =&gt; item.Content)
              &lt;/td&gt;
              &lt;td&gt;
                  @Html.DisplayFor(modelItem =&gt; item.Section)
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;a asp-action=&quot;Edit&quot; asp-route-id=&quot;@item.ID&quot;&gt;Edit&lt;/a&gt; |
                  &lt;a asp-action=&quot;Details&quot; asp-route-id=&quot;@item.ID&quot;&gt;Details&lt;/a&gt; |
                  &lt;a asp-action=&quot;Delete&quot; asp-route-id=&quot;@item.ID&quot;&gt;Delete&lt;/a&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
  }
      &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  <p>Page Model:</p>
  <pre><code>    public class Page
  {
      [Key]
      [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
      public int ID { get; set; }
  
      public string Title { get; set; }
  
      public string Content { get; set; }
  
      public string Section { get; set; }
  }
  </code></pre>
  <p>Database Context:</p>
  <pre><code>    public class ApplicationDbContext : IdentityDbContext
  {
      public ApplicationDbContext(DbContextOptions&lt;ApplicationDbContext&gt; options)
          : base(options)
      {
      }
  
      public DbSet&lt;Page&gt; Pages { get; set; }
  }
  </code></pre>
  <p>Thanks in advance for your solutions and suggestions</p>