public IEnumerable <Product> GetDailyTour() { var listDailyTour = new List <Product>(); var listProduct = productRepository.GetMany(p => p.Deleted == false && p.IsPublic == true); foreach (var product in listProduct) { if (productAttributeRepository.GetAll().Where(p => p.ProductId == product.Id && p.ProductAttributeId == 13 && p.Value.Equals("true")).Count() > 0) { listDailyTour.Add(product); } } //foreach (var daily in listDaily) //{ // if (daily.ProductAttributeMappings.FirstOrDefault(p=>p.ProductAttributeId==13).Value.Equals("true")) // { // listDailyTour.Add(daily); // } //} return(listDailyTour.OrderBy(p => p.Position)); }
/// <summary> /// Gets product attribute mappings by product identifier /// </summary> /// <param name="productId">The product identifier</param> /// <returns>Product attribute mapping collection</returns> public virtual IList <ProductAttributeMapping> GetProductAttributeMappingsByProductId(int productId) { string key = string.Format(PRODUCTATTRIBUTEMAPPINGS_ALL_KEY, productId); return(_cacheManager.GetCache(CACHE_NAME_PRODUCTATTRIBUTEMAPPINGS).Get(key, () => { var query = from pam in _productAttributeMappingRepository.GetAll() orderby pam.DisplayOrder where pam.ProductId == productId select pam; var productAttributeMappings = query.ToList(); return productAttributeMappings; })); }
public IEnumerable <ProductAttributeMapping> GetProductAttributeMappings() { var productAttributeMappings = productAttributeMappingRepository.GetAll(); return(productAttributeMappings); }