public List <ProductEntity> Get(EmployeeEntity EmployeeEntity, ProductSearchEntity ProductSearchEntity) { if (ProductSearchEntity == null) { ProductSearchEntity = new ProductSearchEntity(); } List <Product> Products = UnitOfWork.ProductRepository.List(ProductSearchEntity); return(Products.ToList().Select(p => new ProductEntity(p, p.Category, p.Category.ProductAttributes, p.Discounts, p.Packs, p.ProductPictures, p.ProductValues)).ToList()); }
public int Count(ProductSearchEntity ProductSearchEntity) { if (ProductSearchEntity == null) { ProductSearchEntity = new ProductSearchEntity(); } IQueryable <Product> Products = context.Products; Apply(Products, ProductSearchEntity); return(Products.Count()); }
public List <Product> List(ProductSearchEntity ProductSearchEntity) { if (ProductSearchEntity == null) { ProductSearchEntity = new ProductSearchEntity(); } IQueryable <Product> Products = context.Products .Include(p => p.Category).ThenInclude(c => c.ProductAttributes) .Include(p => p.Discounts) .Include(p => p.Packs) .Include(p => p.ProductPictures) .Include(p => p.ProductValues);; Apply(Products, ProductSearchEntity); SkipAndTake(Products, ProductSearchEntity); return(Products.ToList()); }
private IQueryable <Product> Apply(IQueryable <Product> Products, ProductSearchEntity ProductSearchEntity) { if (ProductSearchEntity.Id.HasValue) { Products = Products.Where(wh => wh.Id == ProductSearchEntity.Id.Value); } if (ProductSearchEntity.CategoryId.HasValue) { Products = Products.Where(wh => wh.CategoryId == ProductSearchEntity.CategoryId.Value); } if (ProductSearchEntity.ManufacturerId.HasValue) { Products = Products.Where(wh => wh.ManufacturerId == ProductSearchEntity.ManufacturerId.Value); } if (!string.IsNullOrEmpty(ProductSearchEntity.Code)) { Products = Products.Where(wh => wh.Code.ToLower().Contains(ProductSearchEntity.Code.ToLower())); } if (!string.IsNullOrEmpty(ProductSearchEntity.Unit)) { Products = Products.Where(wh => wh.Unit.ToLower().Contains(ProductSearchEntity.Unit.ToLower())); } return(Products); }
public List <ProductEntity> Get(ProductSearchEntity SearchProductEntity) { return(ProductService.Get(EmployeeEntity, SearchProductEntity)); }
public long Count(ProductSearchEntity SearchProductEntity) { return(ProductService.Count(EmployeeEntity, SearchProductEntity)); }
public int Count(EmployeeEntity EmployeeEntity, ProductSearchEntity ProductSearchEntity) { return(UnitOfWork.ProductRepository.Count(ProductSearchEntity)); }