From the course: Building and Securing RESTful APIs in ASP.NET Core

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Add pagination

Add pagination - ASP.NET Core Tutorial

From the course: Building and Securing RESTful APIs in ASP.NET Core

Start my 1-month free trial

Add pagination

- [Instructor] If you check out the exercise files for this video, you'll see a few things that I added. I've added some models that represent a booking and an opening in the hotel and their corresponding database entities. I also added services for dealing with these new bookings and openings and a couple of new routes, as well. If you're following along in your own project, you can compare and copy these files from the begin state of this video or it might be easier just to open up the solution in the begin state and keep working from there. One of the new routes that I added demonstrates a problem that the API currently has with returning collections. I'll show you what I mean in Postman. If I request the slash rooms slash openings route, I get a list of all the openings in the hotel. The problem is that this list is massive. Let's add some Pagination function to the API that we can reuse for any collection like this that returns a lot of items. We'll start by adding a class that…

Contents