public async Task <List <DTO.DomainLikeDTO.Sale> > AllAsyncByShop(int?shopId, string order, string searchFor, int?pageIndex, int?pageSize) { var query = RepositoryDbSet .Include(a => a.Description).ThenInclude(t => t.Translations) .Include(a => a.AppUser) .Include(a => a.ProductsSold).ThenInclude(a => a.Product).ThenInclude(aa => aa.ProductName) .ThenInclude(t => t.Translations) .Include(a => a.ProductsSold).ThenInclude(a => a.Product).ThenInclude(aa => aa.Length) .ThenInclude(t => t.Translations) .Include(a => a.ProductsSold).ThenInclude(a => a.Product).ThenInclude(aa => aa.Weight) .ThenInclude(t => t.Translations) .Include(a => a.ProductsSold).ThenInclude(a => a.Product).ThenInclude(aa => aa.ManuFacturerItemCode) .ThenInclude(t => t.Translations) .Include(a => a.ProductsSold).ThenInclude(a => a.Product).ThenInclude(aa => aa.ShopCode) .ThenInclude(t => t.Translations) .Where(p => p.AppUser.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 => SaleMapper.MapFromDomain(e)).ToList(); return(res); }
public async Task <List <DTO.DomainLikeDTO.Sale> > AllAsyncByShopAndUserId(int?shopId, int userId) { return(await RepositoryDbSet .Include(a => a.Description).ThenInclude(t => t.Translations) .Include(a => a.AppUser) .Where(p => p.AppUser.ShopId == shopId) .Where(p => p.AppUserId == userId) .Select(e => SaleMapper.MapFromDomain(e)).ToListAsync()); }
public override async Task <List <Sale> > AllAsync() { return(await RepositoryDbSet .Include(a => a.Description).ThenInclude(t => t.Translations) .Include(a => a.AppUser) .Include(a => a.ProductsSold).ThenInclude(a => a.Product).ThenInclude(aa => aa.ProductName).ThenInclude(t => t.Translations) .Include(a => a.ProductsSold).ThenInclude(a => a.Product).ThenInclude(aa => aa.Length).ThenInclude(t => t.Translations) .Include(a => a.ProductsSold).ThenInclude(a => a.Product).ThenInclude(aa => aa.Weight).ThenInclude(t => t.Translations) .Include(a => a.ProductsSold).ThenInclude(a => a.Product).ThenInclude(aa => aa.ManuFacturerItemCode).ThenInclude(t => t.Translations) .Include(a => a.ProductsSold).ThenInclude(a => a.Product).ThenInclude(aa => aa.ShopCode).ThenInclude(t => t.Translations) .Select(e => SaleMapper.MapFromDomain(e)).ToListAsync()); }
public override async Task <Sale> FindAsync(params object[] id) { var sale = await RepositoryDbSet.FindAsync(id); return(SaleMapper.MapFromDomain(await RepositoryDbSet.Where(a => a.Id == sale.Id) .Include(a => a.Description).ThenInclude(t => t.Translations) .Include(a => a.AppUser) .Include(a => a.ProductsSold).ThenInclude(a => a.Product).ThenInclude(aa => aa.ProductName).ThenInclude(t => t.Translations) .Include(a => a.ProductsSold).ThenInclude(a => a.Product).ThenInclude(aa => aa.Length).ThenInclude(t => t.Translations) .Include(a => a.ProductsSold).ThenInclude(a => a.Product).ThenInclude(aa => aa.Weight).ThenInclude(t => t.Translations) .Include(a => a.ProductsSold).ThenInclude(a => a.Product).ThenInclude(aa => aa.ManuFacturerItemCode).ThenInclude(t => t.Translations) .Include(a => a.ProductsSold).ThenInclude(a => a.Product).ThenInclude(aa => aa.ShopCode).ThenInclude(t => t.Translations) .FirstOrDefaultAsync())); }