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()); }
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())); }
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); }