public override async Task <List <Inventory> > AllAsync() { return(await RepositoryDbSet .Include(i => i.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) .Select(e => InventoryMapper.MapFromDomain(e)).ToListAsync()); }
public override async Task <Inventory> FindAsync(params object[] id) { var inventory = await RepositoryDbSet.FindAsync(id); return(InventoryMapper.MapFromDomain(await RepositoryDbSet.Where(a => a.Id == inventory.Id) .Include(i => i.Description).ThenInclude(t => t.Translations) .Include(a => a.Products).ThenInclude(aa => aa.ProductName).ThenInclude(t => t.Translations) .Include(a => a.Products).ThenInclude(aa => aa.Length).ThenInclude(t => t.Translations) .Include(a => a.Products).ThenInclude(aa => aa.Weight).ThenInclude(t => t.Translations) .Include(a => a.Products).ThenInclude(aa => aa.ManuFacturerItemCode).ThenInclude(t => t.Translations) .Include(a => a.Products).ThenInclude(aa => aa.ShopCode).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) .FirstOrDefaultAsync())); }
public async Task <List <Inventory> > AllAsyncByShop(int?shopId, string order, string searchFor, int?pageIndex, int?pageSize) { var query = RepositoryDbSet .Include(i => i.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) .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 => InventoryMapper.MapFromDomain(e)).ToList(); return(res); }