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.
This is my Class There I want to show all proporties , even photo (image)
public class HouseDTO
{
[Key]
public int HouseId { get; set; }
public Nullable<decimal> Price { get; set; }
public string LiveArea { get; set; }
public string RoomAmount { get; set; }
public string HouseType { get; set; }
public string ImageName { get; set; }
}
And then my Repisitory
public interface IHouseRepository
{
public IEnumerable<HouseDTO> GetAllHouses()
}
public class HouseRepository : IHouseRepository
{
private ApplicationDbContext db;
public HouseRepository(ApplicationDbContext db)
{
this.db = db;
}
public IEnumerable<HouseDTO> GetAllHouses()
{
return db.Houses;
}
}
And this is my Controller
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);
}
}
So How can create Server side Pagination for this action?
public IActionResult Index()
{
var model = db.GetAllHouses();
return View(model);
}
I would greatly appreciate it if you help me.