Пример #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 ActionResult CategoryLeft(bool?IsMenuChild)
        {
            if (!IsMenuChild.HasValue)
            {
                IsMenuChild = false;
            }

            shCategoryService        _category  = new shCategoryService();
            IEnumerable <shCategory> dsCategory = _category.DanhSachCategory()
                                                  .Where(x => string.IsNullOrEmpty(x.ParentId) ||
                                                         string.IsNullOrWhiteSpace(x.ParentId))
                                                  .ToList();

            List <shCategory> dsDanhMuc = dsCategory.ToList();

            if (IsMenuChild.Value)
            {
                foreach (var item in dsCategory)
                {
                    dsDanhMuc.AddRange(_category.DanhSachCategory_ByParentId(item.CategoryGuid));
                }
            }

            return(PartialView("CategoryLeft", dsDanhMuc));
        }