title: How to write code for Server side pagination in ASP.NET Core
body: <p>I want to implement Server side pagination for loading of some data I want to be loaded into browser. It's working fine Client side  with PageList in MVC but I don't know how to do in Asp.net Core Server side.</p>
  
  <p>This is my Class There I want to show all proporties , even photo (image)</p>
  
  <pre><code>public class HouseDTO
      {
          [Key]
          public int HouseId { get; set; }
          public Nullable&lt;decimal&gt; Price { get; set; }
          public string LiveArea { get; set; }
          public string RoomAmount { get; set; }
          public string HouseType { get; set; }
          public string ImageName { get; set; }
      } 
  </code></pre>
  
  <p>And then my Repisitory</p>
  
  <pre><code>public interface IHouseRepository
  {
  
    public IEnumerable&lt;HouseDTO&gt; GetAllHouses()
  
  }
  
   public class HouseRepository : IHouseRepository
   {
  
      private ApplicationDbContext db;
  
      public HouseRepository(ApplicationDbContext db)
      {
              this.db = db;
      }
  
      public IEnumerable&lt;HouseDTO&gt; GetAllHouses()
      {
              return db.Houses;
      }
  }
  </code></pre>
  
  <p>And this is my Controller</p>
  
  <pre><code>public class AdvController : Controller
  {
  
     private IHouseRepository db;
     private IHostingEnvironment hostingEnvirnment;
  
     public AdvController(IHouseRepository db, IHostingEnvironment hostingEnvirnment)
     {
        this.db = db;
        this.hostingEnvirnment = hostingEnvirnment;
  
     }
  
     public IActionResult Index()
     {
       var model = db.GetAllHouses();  // How can I do this to Server side pagination?
       return View(model);
     } 
  }
  </code></pre>
  
  <p>So How can create Server side Pagination for this action?</p>
  
  <pre><code>public IActionResult Index()
  {
     var model = db.GetAllHouses();   
     return View(model);
  }
  </code></pre>
  
  <p>I would greatly appreciate it if you help me.</p>