Generating Pagination using Web API with example [For Beginners]

Published: 19 July 2017
on channel: Thumb IKR - Programming Examples
8,933
like

Use Pagination in Web API Design. Paging in a REST API. ASP.NET Core Web API.

CRUD operation using Web API (Http Call) in ASP.Net Core with Example :
   • CRUD Operation using Web API in ASP.N...  

Use of AutoMapper in Web API for Data Transfer Object or ViewModel ASP.NET Core with example :    • Use AutoMapper with ASP.NET Core Web ...  

(Affiliate Links)
----------------------------------------------------------------------------------------------------
👍Top 5 ASP.NET Core Courses :
----------------------------------------------------------------------------------------------------
1. https://rb.gy/ljcz6j
2. https://rb.gy/hjrmoy
3. https://rb.gy/tqv5pi
4. https://rb.gy/gexk9v
5. https://rb.gy/s4mfcm
----------------------------------------------------------------------------------------------------
👍Top 5 Web API Courses :
----------------------------------------------------------------------------------------------------
1. https://rb.gy/p6axtl
2. https://rb.gy/zx0ggc
3. https://rb.gy/5av6ws
4. https://rb.gy/fbhl0m
5. https://rb.gy/1rso3o

Here I am going to show how we can use pagination in Wep Api step by step Asp.Net Core

1. Create PagedList generic class.
2. Make constructor of PagedList Class.
3. Create a pagedList create method.
4. Create PaginationResourceParameters.
5. PaginationResourceParameters Done.
6. Create ResourceUriType Enum.
7. I already have an object class named Student.cs.
I want to apply my pagination on StudentWebApiController.
8. Create StudentResourceParameters class.
9. Create IStudentRepository.
10. Create StudentRepository.cs class.
11. Register Student repository in startup.cs.
12. Add IUrlHelper and IActionContextAccessor in startup.cs.
13. Basic part is done. Create StudentsController and test our project.
14. Lets create CreateResourceUri method.
15. CreateResourceUri method done. Now I am going apply this method.
16. Create StudentViewModel.cs (DTO related)
17. Ok done.
18. Now I am going to test this project. open postman for testing our GetStudents API.
19. I have already 50+ student entry in my database.

===============================================
✅ OTHER INFORMATION :
===============================================
✔️ 1st Tutorial Channel :    / thumbikr  
✔️ 2nd Tutorial Channel :    / bclblazorcorelearning  
✔️ All Source Codes : https://payhip.com/ThumbIKR/collectio...
✔️ Support : https://www.paypal.com/donate/?cmd=_s...
✔️ Website : https://thumbikr.blogspot.com
✔️ FB Page :   / thumbikr.official  
----------------------------------------------------------------------------------------------------

Output :
20. So by default 10 students are showing as output.
21. pageSize = 5 means I want to show maximum 5 students in each page.
22. pageNumber = 1 means display page 1
23. Now I want to see next page's 5 students.
24. Now I want to see 10 students in my first page.
25. Want to see 10 students of my 3rd page.
26. So from header part you can get idea from x-pagination ==
totalCount:59,
pageSize:10,
currentPage:3,
totalPage:6,
previousPageLink:null,
nextPageLink:null

Thats all. Thanks for watching :)
If you like this video then please subscribe my channel and like this video.

Thank you. :)

#WebAPI #Pagination #ThumbIKR


On this page of the site you can watch the video online Generating Pagination using Web API with example [For Beginners] with a duration of hours minute second in good quality, which was uploaded by the user Thumb IKR - Programming Examples 19 July 2017, share the link with friends and acquaintances, this video has already been watched 8,933 times on youtube and it was liked by like viewers. Enjoy your viewing!