@@ -50,17 +50,17 @@ public interface IYourEntityService
50
50
Task DeleteAsync (YourEntity entity );
51
51
52
52
// Alternative method for extracting all records
53
- Task <IEnumerable <TEntity >> GetAllEntitiesAsync (Func <TEntity , bool > predicate )
53
+ Task <IEnumerable <YourEntity >> GetAllEntitiesAsync (Func <YourEntity , bool > predicate )
54
54
55
55
// Alternative method for deleting
56
56
Task DeleteByIdAsync(int id );
57
57
58
58
// 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 );
64
64
}
65
65
```
66
66
@@ -113,12 +113,14 @@ public class YourEntityService : IYourEntityService
113
113
await _repository .DeleteByIdAsync (id );
114
114
}
115
115
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>,
118
120
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 )
120
122
{
121
- return await _repository .GetPaginatedAsync (includes , conditionWhere , orderBy , orderType , pageIndex , pageSize );
123
+ return await _repository .GetPaginatedAsync (includes , conditionWhere , orderBy , ascending , pageIndex , pageSize );
122
124
}
123
125
}
124
126
```
0 commit comments