CitiesController

Now, we can open our /Controllers/CitiesController.cs file and make the following changes:

[HttpGet]public async Task<ActionResult<ApiResult<City>>> GetCities(        int pageIndex = 0,        int pageSize = 10,        string sortColumn = null,        string sortOrder = null,        string filterColumn = null,        string filterQuery = null){    return await ApiResult<City>.CreateAsync(            _context.Cities,            pageIndex,            pageSize,            sortColumn,            sortOrder,            filterColumn,            filterQuery);}

The preceding code is very similar to the alternative implementation that we assumed in the previous section: as we mentioned earlier, both approaches are viable, depending on our tastes. However, since we're going to use this same implementation for the countries in a short while, making good ...

Get ASP.NET Core 3 and Angular 9 - Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.