示例#1
0
        public ActionResult DsProduct(string CategoryGuid, int?page)
        {
            int pageCurrent = 1;

            if (page.HasValue)
            {
                pageCurrent = page.Value;
            }
            shCategoryService _category = new shCategoryService();

            IEnumerable <shCategory> ds = _category.DanhSachCategory_ByParentId(CategoryGuid);

            shProductService _product  = new shProductService();
            List <shProduct> dsProduct = new List <shProduct>();

            foreach (var item in ds)
            {
                dsProduct.AddRange(_product.DanhSachProduct_TheoDanhMuc(item.CategoryGuid));
            }

            dsProduct.AddRange(_product.DanhSachProduct_TheoDanhMuc(CategoryGuid));

            ViewBag.dsProduct    = dsProduct.OrderByDescending(x => x.ProductId).ToPagedList(pageCurrent, Config.PAGE_SIZE_8);
            ViewBag.CategoryGuid = CategoryGuid;
            return(PartialView("dsProduct", ViewBag.dsProduct));
        }
示例#2
0
        public List <TreeView> ProductByCategoryGuid(string CategoryGuid)
        {
            if (!string.IsNullOrWhiteSpace(CategoryGuid))
            {
                TreeView        zTree      = null;
                List <TreeView> dsTreeview = new List <TreeView>();

                shProductService        _product  = new shProductService();
                IEnumerable <shProduct> dsProduct = _product.DanhSachProduct_TheoDanhMuc(CategoryGuid);

                foreach (var item in dsProduct)
                {
                    zTree = new TreeView();

                    zTree.name = item.ProductName;
                    zTree.id   = item.ProductId.ToString();
                    //zTree.pId = UnitId.ToString();
                    zTree.isParent = false;
                    zTree.children = null;
                    zTree.click    = null;
                    zTree.open     = true;

                    dsTreeview.Add(zTree);
                }

                return(dsTreeview);
            }

            return(new List <TreeView>());
        }
示例#3
0
        /// <summary>
        /// Những sản phẩm liên quan
        /// </summary>
        /// <param name="ProductGuid"></param>
        /// <returns></returns>
        public ActionResult RelatedProducts(string ProductGuid, string CategoryGuid)
        {
            shProductService _product = new shProductService();

            IEnumerable <shProduct> dsProduct = _product.DanhSachProduct_TheoDanhMuc(CategoryGuid)
                                                .Where(x => x.ProductGuid != ProductGuid);

            return(PartialView("RelatedProducts", dsProduct));
        }