예제 #1
0
        public ActionResult <Api <List <DepartmentDTO> > > GetAll(
            [FromQuery(Name = "page"), DefaultValue(1), Required] int page,                                                //
            [FromQuery(Name = "page_limit"), DefaultValue(10), ] int limit                                                 //
            )
        {
            int totalItems = _departmentService.CountAll();

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

            List <DepartmentDTO> dtos = _departmentService.FindAll(page, limit);

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

            return(Ok(result));
        }