@@ -50,17 +50,17 @@ public interface IYourEntityService
5050 Task DeleteAsync (YourEntity entity );
5151
5252 // Alternative method for extracting all records
53- Task <IEnumerable <TEntity >> GetAllEntitiesAsync (Func <TEntity , bool > predicate )
53+ Task <IEnumerable <YourEntity >> GetAllEntitiesAsync (Func <YourEntity , bool > predicate )
5454
5555 // Alternative method for deleting
5656 Task DeleteByIdAsync(int id );
5757
5858 // Optional method
59- Task <List <PersonEntity >> GetPaginatedAsync (Func<IQueryable<PersonEntity >,
60- IIncludableQueryable<PersonEntity , object>> includes,
61- Expression <Func <PersonEntity , bool >> conditionWhere ,
62- Expression <Func <PersonEntity , dynamic >> orderBy ,
63- string orderType , int pageIndex , int pageSize );
59+ Task <List <YourEntity >> GetPaginatedAsync (Func<IQueryable<YourEntity >,
60+ IIncludableQueryable<YourEntity , object>> includes,
61+ Expression <Func <YourEntity , bool >> conditionWhere ,
62+ Expression <Func <YourEntity , dynamic >> orderBy ,
63+ bool ascending , int pageIndex , int pageSize );
6464}
6565```
6666
@@ -113,12 +113,14 @@ public class YourEntityService : IYourEntityService
113113 await _repository .DeleteByIdAsync (id );
114114 }
115115
116- // Optional method
117- public async Task <List <YourEntity >> GetPaginatedAsync (Func<IQueryable<YourEntity>,
116+ // Optional method for pagination
117+ // If ascending is passed to true, the list is sorted in ascending order.
118+ // If ascending is passed to false, the list is sorted in descending order.
119+ public Task <List <YourEntity >> GetPaginatedAsync (Func<IQueryable<YourEntity>,
118120 IIncludableQueryable<YourEntity, object>> includes, Expression <Func <YourEntity , bool >> conditionWhere ,
119- Expression <Func <YourEntity , dynamic >> orderBy , string orderType , int pageIndex , int pageSize )
121+ Expression <Func <YourEntity , dynamic >> orderBy , bool ascending , int pageIndex , int pageSize )
120122 {
121- return await _repository .GetPaginatedAsync (includes , conditionWhere , orderBy , orderType , pageIndex , pageSize );
123+ return await _repository .GetPaginatedAsync (includes , conditionWhere , orderBy , ascending , pageIndex , pageSize );
122124 }
123125}
124126```
0 commit comments