public List <ProductModel> GetListByCateIdNoCache(int cateId, int top) { List <ProductModel> lstModel = new List <ProductModel>(); List <ProductEntity> lstProduct = _productDal.GetListByCateId(cateId, top); if (lstProduct != null && lstProduct.Count > 0) { //lstModel = lstProduct.Select(x => new ProductModel(x)).ToList(); CategoryEntity category = new CategoryEntity(); foreach (ProductEntity item in lstProduct) { category = _categoryBo.GetByCateId(item.CatalogID); if (category != null && category.CatalogID > 0) { ProductModel productModel = new ProductModel(item, category); lstModel.Add(productModel); } } } return(lstModel); }
public MetaModel BuildMetaProduct(SearchProduct searchInfo) { MetaModel metaTag = new MetaModel() { TitlePage = "Sản phẩm", MetaTitle = Const.MetaProductTitle, MetaDescription = Const.MetaProductDescription, MetaKeyword = Const.MetaProductKeyword }; if (!string.IsNullOrEmpty(searchInfo.TextSearch)) { metaTag.TitlePage = string.Format("Tìm kiếm: \"{0}\"", searchInfo.TextSearch); metaTag.MetaTitle = string.Format("Tìm kiếm: \"{0}\"", searchInfo.TextSearch); metaTag.MetaDescription = string.Format("Tìm kiếm: \"{0}\"", searchInfo.TextSearch); } else if (searchInfo.CateId > 0) { CategoryEntity cateInfo = _categoryBo.GetByCateId(searchInfo.CateId); if (cateInfo != null && cateInfo.CatalogID > 0) { metaTag.TitlePage = cateInfo.Name; metaTag.MetaTitle = cateInfo.Name; metaTag.MetaDescription = cateInfo.Name; } } if (searchInfo.PageIndex > 1) { metaTag.TitlePage = string.Concat(metaTag.TitlePage, " - trang " + searchInfo.PageIndex); if (!string.IsNullOrEmpty(Const.PrefixTitle)) { metaTag.TitlePage = string.Concat(metaTag.TitlePage, " - ", Const.PrefixTitle); } } return(metaTag); }
public ActionResult ProductTop(int cateId, int top) { ProductModelBox model = new ProductModelBox(); CategoryEntity cateInfo = _categoryBo.GetByCateId(cateId); if (cateInfo != null && cateInfo.CatalogID > 0) { List <ProductModel> lstProduct = _productBo.GetListByCateId(cateId, top); model = new ProductModelBox { TitleBox = cateInfo.Name, UrlBox = cateInfo.DisplayUrl, ProductList = lstProduct }; } return(PartialView("_ProductTop", model)); }