public async Task <IActionResult> GetAll([FromQuery] FilterServiceOfPattientVM filter) => Ok(await _service.ServiceOfPattientService.GetAllWithPaginateAsync(filter));
public async Task <PaginationViewModel <ServiceOfPatient> > GetAllWithPaginateAsync(FilterServiceOfPattientVM filterEntity) { var result = GetAll(); if (filterEntity.DentalBranchId != Guid.Empty) { result = result.Where(x => x.DentalBranchId == filterEntity.DentalBranchId); } var total = result.Count(); var pages = total / filterEntity.QuantityByPage; return(new PaginationViewModel <ServiceOfPatient> { ActualPage = filterEntity.Page, Pages = pages, Total = total, Entities = await result.Skip((filterEntity.Page - 1) *filterEntity.QuantityByPage).Take(filterEntity.QuantityByPage) .OrderByDescending(x => x.CreateAt).ToListAsync() }); }