public async Task <ProductItem> GetIncludeProductAsync(int id) { ProductItem item = await DbSetEntity .Include(x => x.Product).FirstOrDefaultAsync(y => y.Id == id); return(item); }
public async Task <Product> GetWithIncludeAsync(int id) { Product product = await DbSetEntity .Include(c => c.Category) .Include(po => po.ProductItems) .FirstAsync(x => x.Id == id); return(product); }
public async Task <int> GetAmountByIdAsync(int id) { var product = await DbSetEntity.Include(x => x.ProductItems) .FirstOrDefaultAsync(y => y.Id == id); int count = product.ProductItems.Count; return(count); }
public async Task <Order> GetWithIncludeAsync(int id) { Order order = await DbSetEntity .Include(x => x.AppUser) .Include(y => y.Discount) .Include(z => z.ProductItems) .FirstOrDefaultAsync(t => t.Id == id); return(order); }
public async Task <List <Order> > GetAllWithIncludeAsync() { List <Order> orders = await DbSetEntity .Include(x => x.AppUser) .Include(y => y.Discount) .Include(z => z.ProductItems) .ToListAsync(); return(orders); }
public async Task <int> GetStockByIdAsync(int id) { var product = await DbSetEntity.Include(x => x.ProductItems) .FirstOrDefaultAsync(y => y.Id == id); List <ProductItem> items = product.ProductItems .FindAll(x => x.Status == Enums.ProductItemStatus.Available); if (items is null) { return(0); } int count = items.Count; return(count); }
public async Task <List <ProductItem> > GetAllIncludeProductAsync() { var items = await DbSetEntity.Include(x => x.Product).ThenInclude(y => y.Category).ToListAsync(); return(items); }