Esempio n. 1
0
 public async Task <PageDTO <TravelDTO> > GetTravelsByPageAsync(int pageSize, int pageIndex, bool isShow)
 {
     return(await Task.Run(() =>
     {
         Expression <Func <TravelEntity, bool> > expression = a => true;
         if (isShow)
         {
             expression = expression.And(a => a.isShow == isShow);
         }
         var travels = TravelRepository.GetModelsByPage(pageSize, pageIndex, false, a => a.createDate,
                                                        expression, out var total).Include(a => a.imgList).ThenInclude(a => a.fileAttachment).ToList();
         var travelDtoList = Mapper.Map <List <TravelDTO> >(travels);
         return new PageDTO <TravelDTO>(pageIndex, pageSize, total, travelDtoList);
     }));
 }