コード例 #1
0
        public ActionResult <Api <List <DistrictDTO> > > GetAllDistrict(   //
            [FromQuery(Name = "page"), DefaultValue(1)] int page,          //
            [FromQuery(Name = "page_limit"), DefaultValue(10), ] int limit //
            )
        {
            int totalItems = _districtService.CountAll();

            int totalPages = (int)Math.Ceiling((double)totalItems / limit);

            List <DistrictDTO> dtos = _districtService.FindAll(page, limit);

            Api <List <DistrictDTO> > result = new Api <List <DistrictDTO> >(200, dtos, "Success", new Paging(page, limit, totalPages, totalItems));

            return(Ok(result));
        }