title: Implement Pagination in ASP.NET Core 2.1 Web API
body: <p>I searched, but did't really found articles on how to implement pagination logic in an ASP.NET WebAPI Core 2.1 application...</p>
  
  <p>I have the following</p>
  
  <pre><code>[Route("api/[controller]")]
  [ApiController]
  [EnableCors("AllowMyOrigin")]
  public class EntriesController : ControllerBase
  {
      private readonly EntriesContext _context;
  
      public EntriesController(EntriesContext context) {
          _context = context;
  
          if (_context.Entries.Count() == 0) {
              _context.Entries.Add(new Entry { From = "default", To = "default" });
              _context.SaveChanges();
          }
      }
  
      [HttpGet]
      public ActionResult&lt;List&lt;Entry&gt;&gt; GetAll() {
          return _context.Entries.ToList();
      }
  
      [HttpGet("{id}", Name = "GetEntry")]
      public ActionResult&lt;Entry&gt; GetById(long id) {
          var item = _context.Entries.Find(id);
          if (item == null) { return NotFound(); }
          return item;
      }
  </code></pre>
  
  <p>Now, I want my entries to be paginated using new params <strong><code>page</code></strong> and <strong><code>pageSize</code></strong>. Say </p>
  
  <pre><code>/api/entries?pageSize=3&amp;page=2 
  </code></pre>
  
  <p>Should I use the <code>GetAll()</code> method by adding some http params to it, or rather create a new method? There are no much sense to use <code>page</code> without <code>pageSize</code>, how do I manage this?</p>