Exemplo n.º 1
0
        public ActionResult BrandsListControl(string B_Categorys = "1", string B_Brands = "", int type = 0)
        {
            IEnumerable <FilterConditionModel> CP_BrandList =
                ProductLibraryConfigController.QueryProducts(new SeachProducts()
            {
                Category = B_Categorys
            })?.CP_BrandList ??
                new List <FilterConditionModel>();

            if (CP_BrandList != null && CP_BrandList.Any() && !string.IsNullOrWhiteSpace(B_Brands))
            {
                CP_BrandList?.ToList().ForEach(a =>
                {
                    var brands = B_Brands.Split(',');
                    foreach (var item in brands)
                    {
                        if (a.Name.Contains(item))
                        {
                            a.Name = a.Name + ":True";
                        }
                    }
                });
            }

            var B_CategorysId = (B_Categorys ?? "").Contains(".")
                ? B_Categorys.Substring(B_Categorys.LastIndexOf(".") + 1)
                : B_Categorys;

            ViewBag.BrandsListControlCategorys = SE_MDBeautyPartConfigController.InteriorCategorysTreeJson(B_CategorysId);
            ViewBag.CP_BrandList = CP_BrandList;
            ViewBag.Type         = type;

            return(View());
        }
        public ActionResult BrandListSelect(string B_Categorys = "1")
        {
            IEnumerable <FilterConditionModel> cpBrandList =
                ProductLibraryConfigController.QueryProducts(new SeachProducts()
            {
                category = B_Categorys
            })?.CP_BrandList ??
                new List <FilterConditionModel>();

            //if (cpBrandList != null && cpBrandList.Any() && !string.IsNullOrWhiteSpace(B_Brands))
            //{
            //    cpBrandList.ForEach(a =>
            //    {
            //        var brands = B_Brands.Split(',');
            //        foreach (var item in brands)
            //        {
            //            if (a.Name.Contains(item))
            //                a.Name = a.Name + ":True";
            //        }
            //    });
            //}

            //var B_CategorysId = (B_Categorys ?? "").Contains(".")
            //    ? B_Categorys.Substring(B_Categorys.LastIndexOf(".") + 1)
            //    : B_Categorys;

            //ViewBag.BrandsListControlCategorys = InteriorCategorysTreeJson();
            ViewBag.CP_BrandList = cpBrandList;
            ViewBag.B_Categorys  = InteriorCategorysTreeJson();
            return(View());
        }
Exemplo n.º 3
0
        /// <summary>
        /// 品牌checkbox列表
        /// </summary>
        public ActionResult BrandsCheckBoxListControl(string categorys = "1")
        {
            IEnumerable <FilterConditionModel> CP_BrandList = ProductLibraryConfigController.QueryProducts(new SeachProducts()
            {
                category = categorys
            })?.CP_BrandList ?? new List <FilterConditionModel>();

            return(View(CP_BrandList));
        }
Exemplo n.º 4
0
        public JsonResult GetBrandsByCategory(string Categorys = "1")
        {
            var paras  = Categorys.Split(';').Where(g => !string.IsNullOrEmpty(g));
            var result = new List <string>();

            if (paras != null)
            {
                foreach (var item in paras)
                {
                    var data = ProductLibraryConfigController.QueryProducts(new SeachProducts()
                    {
                        Category = item
                    })?.CP_BrandList.Select(g => g.Name)?.ToList() ?? new List <string>();
                    if (data.Any())
                    {
                        result.AddRange(data);
                    }
                }
            }
            result = result.Where(g => !string.IsNullOrEmpty(g)).Distinct()?.ToList() ?? new List <string>();
            return(Json(new { Code = result.Any() ? 1 : 0, Data = result }));
        }