title: Does not contain definition for ToPagedList
body: <p>I keep getting this error when trying to implement PagedList in my Controller. The exact error reads </p>
  
  <blockquote>
    <p>'DataIntelligence.Models.Execution' does not contain a definition for 'ToPagedList' and no extension method 'ToPagedList' accepting a first argument of type 'DataIntelligence.Models.Execution' could be found (are you missing a using directive or an assembly reference?)` </p>
  </blockquote>
  
  <p>and I have no idea why. I have looked at similar question but can't seem to find the answer I am looking for. I was wondering if anybody could help.</p>
  
  <h2>Controller</h2>
  
  <pre><code>using DataIntelligence.Models;
  using PagedList;
  using PagedList.Mvc;
  using System;
  using System.Linq;
  using System.Web.Mvc;
  
  public ActionResult Execution(int? page, int id = 0)
  {
      var execution = db.Executions.Find(id);
  
      if (execution == null)
      {
          return HttpNotFound();
      }
  
      ViewBag.ExecutionSeconds = (execution.End - execution.Start).ToString(@"dd\.hh\:mm\:ss\.fff");
  
      int pageSize = Int32.Parse(System.Configuration.ConfigurationManager.AppSettings["DefaultPageSize"]);
                  int pageNumber = (page ?? 1);
      return View(execution.ToPagedList(pageNumber, pageSize));
  }
  </code></pre>
  
  <h2>Execution Model</h2>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel.DataAnnotations;
  using System.ComponentModel.DataAnnotations.Schema;
  using System.Linq;
  using System.Web;
  
  
  namespace DataIntelligence.Models
  {
      [Table("Execution")]
      public class Execution
      {
          public int Id { get; set; }
          public Int16 PackageId { get; set; }
          public DateTime Start { get; set; }
          public DateTime End { get; set; }
          public Boolean Successful { get; set; }
  
          public virtual ICollection&lt;Step&gt; Steps { get; set; }
      }
  }
  </code></pre>
  
  <h2>View</h2>
  
  <pre><code>@model PagedList.IPagedList&lt;DataIntelligence.Models.Execution&gt;
  @using PagedList.Mvc;
  
  &lt;link href="Content/PagedList.css" rel="stylesheet" type="text/css" /&gt;
  
  @{
      ViewBag.Title = "Execution Details";
  }
  &lt;script language="javascript" type="text/javascript" src="jquery-1.8.3.js"&gt;    &lt;/script&gt;
  &lt;script&gt;
      function goBack() {
          window.history.back();
      }
  &lt;/script&gt;
  &lt;div class="jumbotron"&gt;
      &lt;h2&gt;Execution Details&lt;/h2&gt;
  &lt;/div&gt;
  
  &lt;fieldset&gt;
      &lt;legend&gt;Execution Id - @Html.DisplayFor(model =&gt; model.Id)&lt;/legend&gt;
  
      &lt;div class="row"&gt;
          &lt;div class="col-sm-3"&gt;
              &lt;div class="display-label"&gt;
                  @Html.DisplayNameFor(model =&gt; model.PackageId)
              &lt;/div&gt;
              &lt;div class="display-field"&gt;
                  &lt;a href="@Url.Action("Package", new { id=Model.PackageId})"&gt; @Html.DisplayFor(model =&gt; model.PackageId) &lt;/a&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div class="col-sm-3"&gt;
              &lt;div class="display-label"&gt;
                  @Html.DisplayNameFor(model =&gt; model.Start)
              &lt;/div&gt;
              &lt;div class="display-field"&gt;
                  @Html.DisplayFor(model =&gt; model.Start)
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="col-sm-3"&gt;
              &lt;div class="display-label"&gt;
                  @Html.DisplayNameFor(model =&gt; model.End)
              &lt;/div&gt;
              &lt;div class="display-field"&gt;
                  @Html.DisplayFor(model =&gt; model.End)
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="col-sm-3"&gt;
              &lt;div class="display-label"&gt;
                  Execution Time
              &lt;/div&gt;
              &lt;div class="display-field"&gt;
                  @ViewBag.ExecutionSeconds
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="row"&gt;
          &lt;div class="col-sm-3"&gt;
              &lt;div class="display-label"&gt;
                  @Html.DisplayNameFor(model =&gt; model.Successful)
              &lt;/div&gt;
              &lt;div class="display-field"&gt;
                  @Html.DisplayFor(model =&gt; model.Successful)
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;br /&gt;
  &lt;/fieldset&gt;
  
  &lt;table&gt;
      &lt;tr&gt;
          &lt;th&gt;
              Step ID
          &lt;/th&gt;
          &lt;th id="stepname"&gt;
              Name
          &lt;/th&gt;
          &lt;th id="stepdate"&gt;
              Date
          &lt;/th&gt;
      &lt;/tr&gt;
  
      @foreach (var step in Model.Steps) {
         &lt;tr&gt;
              &lt;td&gt;
                 @Html.DisplayFor(modelItem =&gt; step.Id)
              &lt;/td&gt;
              &lt;td id="steps"&gt;
                  @Html.DisplayFor(modelItem =&gt; step.Name)
              &lt;/td&gt;
              &lt;td id="date"&gt;
                  @Html.DisplayFor(modelItem =&gt; step.Date)
              &lt;/td&gt;
          &lt;/tr&gt;
      }
  &lt;/table&gt;
  &lt;button class="btn btn-link" onclick="goBack()" style="padding-right: 0px; padding-top: 0px; padding-bottom: 0px; padding-left: 0px;"&gt;Back&lt;/button&gt;
  
  Page @(Model.Steps.PageCount &lt; Model.Steps.PageNumber ? 0 :  Model.Steps.PageNumber) of @Model.Steps.PageCount
  @Html.PagedListPager(Model.Steps, page =&gt; Url.Action("Execution", new { page, sortOrder = ViewBag.CurrentSort}))
  </code></pre>