public ActionResult ChildCategory(int?psn, string emptyTitle = "请选择")
        {
            var childtypes = new List <DropdownItem>();

            if (psn.HasValue)
            {
                childtypes = ProductCategoryService.GetChildCategorys(psn.Value).Select(o => new DropdownItem(o.CategorySN.ToString(), o.Title)).ToList();
            }
            if (!emptyTitle.IsNullOrEmpty())
            {
                childtypes.Insert(0, new DropdownItem("", Server.UrlDecode(emptyTitle), true));
            }
            return(new JsonNetResult(childtypes));
        }
Пример #2
0
        public ActionResult ParentTypeSelect(int?id, short?showTitle)
        {
            var childtypes = new List <DropdownItem>();

            if (id.HasValue)
            {
                childtypes = ProductCategoryService.GetChildCategorys(id.GetValueOrDefault()).Select(o => new DropdownItem(o.CategorySN.ToString(), o.Title)).ToList();
            }
            if (showTitle == 1)
            {
                childtypes.Insert(0, new DropdownItem("", "子类", true));
            }
            return(new JsonNetResult(childtypes));
        }