예제 #1
0
 public override async Task <List <Shipper> > AllAsync()
 {
     return(await RepositoryDbSet
            .Include(a => a.ShipperName).ThenInclude(t => t.Translations)
            .Include(a => a.ShipperAddress).ThenInclude(t => t.Translations)
            .Include(a => a.PhoneNumber).ThenInclude(t => t.Translations)
            .Select(e => ShipperMapper.MapFromDomain(e)).ToListAsync());
 }
예제 #2
0
        public override async Task <Shipper> FindAsync(params object[] id)
        {
            var shipper = await RepositoryDbSet.FindAsync(id);

            return(ShipperMapper.MapFromDomain(await RepositoryDbSet.Where(a => a.Id == shipper.Id)
                                               .Include(a => a.ShipperName).ThenInclude(t => t.Translations)
                                               .Include(a => a.ShipperAddress).ThenInclude(t => t.Translations)
                                               .Include(a => a.PhoneNumber).ThenInclude(t => t.Translations)
                                               .FirstOrDefaultAsync()));
        }
예제 #3
0
        public async Task <List <Shipper> > AllAsync(string order, string searchFor, int?pageIndex, int?pageSize)
        {
            var query = RepositoryDbSet
                        .Include(a => a.ShipperName).ThenInclude(t => t.Translations)
                        .Include(a => a.ShipperAddress).ThenInclude(t => t.Translations)
                        .Include(a => a.PhoneNumber).ThenInclude(t => t.Translations)
                        .AsQueryable();

            query = Search(query, searchFor);
            query = Order(query, order);
            if (pageIndex != null && pageSize != null)
            {
                query = query.Skip((pageIndex.Value - 1) * pageSize.Value).Take(pageSize.Value);
            }
            var temp = await query.ToListAsync();

            var res = temp.Select(e => ShipperMapper.MapFromDomain(e)).ToList();

            return(res);
        }