public BaseProductFilter GetMinMaxForProductSearch(string search) { var query = _unitOfWork.ProductRepository.GetSearchCataloguePricingFilterQuery(search); var prodList = _unitOfWork.ExecuteQuery <int>(query).ToList <int>(); BaseProductFilter filter = new BaseProductFilter(); filter.Max = _unitOfWork.PricingRepository.Find(x => prodList.Contains(x.Product)).Max(x => x.Price); filter.Min = _unitOfWork.PricingRepository.Find(x => prodList.Contains(x.Product)).Min(x => x.SpecialPrice); filter.Brand = _unitOfWork.ProductRepository.GetBrandFilter(prodList); return(filter); }
public BaseProductFilter GetMinMaxForProductCategory(int id) { var catIdList = _unitOfWork.CategoryRepository.Find(x => x.ParentCategoryId == id || x.CategoryId == id) .Select(x => x.CategoryId) .ToList <int>(); var prodList = _unitOfWork.ProductRepository.Find(x => catIdList.Contains(x.Category)).Select(x => x.ProductId).ToList <int>(); BaseProductFilter filter = new BaseProductFilter(); filter.Max = _unitOfWork.PricingRepository.Find(x => prodList.Contains(x.Product)).Max(x => x.Price); filter.Min = _unitOfWork.PricingRepository.Find(x => prodList.Contains(x.Product)).Min(x => x.SpecialPrice); filter.Brand = _unitOfWork.ProductRepository.GetBrandFilter(prodList); return(filter); }