Пример #1
0
 public override async Task <List <Defect> > AllAsync()
 {
     return(await RepositoryDbSet
            .Include(d => d.Description).ThenInclude(t => t.Translations)
            .Include(a => a.Shop).ThenInclude(aa => aa.ShopName).ThenInclude(t => t.Translations)
            .Include(a => a.Shop).ThenInclude(aa => aa.ShopAddress).ThenInclude(t => t.Translations)
            .Include(a => a.Shop).ThenInclude(aa => aa.ShopContact).ThenInclude(t => t.Translations)
            .Include(a => a.Shop).ThenInclude(aa => aa.ShopContact2).ThenInclude(t => t.Translations)
            .Include(a => a.ProductsWithDefect).ThenInclude(aa => aa.Product).ThenInclude(aaa => aaa.ProductName).ThenInclude(t => t.Translations)
            .Select(e => DefectMapper.MapFromDomain(e)).ToListAsync());
 }
Пример #2
0
        public override async Task <Defect> FindAsync(params object[] id)
        {
            var defect = await RepositoryDbSet.FindAsync(id);

            return(DefectMapper.MapFromDomain(await RepositoryDbSet
                                              .Include(d => d.Description).ThenInclude(t => t.Translations)
                                              .Include(a => a.Shop).ThenInclude(aa => aa.ShopName).ThenInclude(t => t.Translations)
                                              .Include(a => a.Shop).ThenInclude(aa => aa.ShopAddress).ThenInclude(t => t.Translations)
                                              .Include(a => a.Shop).ThenInclude(aa => aa.ShopContact).ThenInclude(t => t.Translations)
                                              .Include(a => a.Shop).ThenInclude(aa => aa.ShopContact2).ThenInclude(t => t.Translations)
                                              .Include(a => a.ProductsWithDefect).ThenInclude(aa => aa.Product).ThenInclude(aaa => aaa.ProductName).ThenInclude(t => t.Translations)
                                              .Where(a => a.Id == defect.Id)
                                              .FirstOrDefaultAsync()));
        }
Пример #3
0
        public async Task <List <Defect> > AllAsyncByShop(int?shopId, string order, string searchFor, int?pageIndex, int?pageSize)
        {
            var query = RepositoryDbSet
                        .Include(d => d.Description).ThenInclude(t => t.Translations)
                        .Include(a => a.Shop).ThenInclude(aa => aa.ShopName).ThenInclude(t => t.Translations)
                        .Include(a => a.Shop).ThenInclude(aa => aa.ShopAddress).ThenInclude(t => t.Translations)
                        .Include(a => a.Shop).ThenInclude(aa => aa.ShopContact).ThenInclude(t => t.Translations)
                        .Include(a => a.Shop).ThenInclude(aa => aa.ShopContact2).ThenInclude(t => t.Translations)
                        .Include(a => a.ProductsWithDefect).ThenInclude(aa => aa.Product).ThenInclude(aaa => aaa.ProductName)
                        .ThenInclude(t => t.Translations)
                        .Where(s => s.ShopId == shopId).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 => DefectMapper.MapFromDomain(e)).ToList();

            return(res);
        }