示例#1
0
        public List <CategoryByCategory> GetListCategory()
        {
            var _factory = new CMSCategoriesFactory();
            //var data = _factory.GetList().Where(x => !string.IsNullOrEmpty(x.ParentId)).Select(x => new SelectListItem
            //{
            //    Value = x.Id,
            //    Text = x.CategoryName,
            //}).ToList();
            //return data;
            var models = new List <CategoryByCategory>();
            var data   = _factory.GetList();

            if (data != null)
            {
                var groupCate = data.Where(x => string.IsNullOrEmpty(x.ParentId)).ToList();
                if (groupCate != null)
                {
                    groupCate.ForEach(x =>
                    {
                        var model      = new CategoryByCategory();
                        model.id       = x.Id;
                        model.text     = x.CategoryName.ToUpper();
                        model.children = data.Where(y => !string.IsNullOrEmpty(y.ParentId) && y.ParentId.Equals(x.Id))
                                         .Select(z => new CategoryChildren
                        {
                            id   = z.Id,
                            text = z.CategoryName
                        }).ToList();
                        models.Add(model);
                    });
                }
            }

            return(models);
        }
示例#2
0
 public NewsController()
 {
     _fac     = new CMSNewsFactory();
     _facCate = new CMSCategoriesFactory();
     _facPro  = new CMSProductFactory();
     _facCom  = new CMSCompaniesFactory();
 }
 public HomeController()
 {
     _fac     = new CMSProductFactory();
     _facCom  = new CMSCompaniesFactory();
     _facCate = new CMSCategoriesFactory();
     _facNews = new CMSNewsFactory();
     _facEmp  = new CMSEmployeeFactory();
 }
示例#4
0
        public List <SelectListItem> GetListCategorySelectItem()
        {
            var _factory = new CMSCategoriesFactory();
            var data     = _factory.GetList().Select(x => new SelectListItem
            {
                Value = x.Id,
                Text  = x.CategoryName,
            }).ToList();

            return(data);
        }
示例#5
0
        public List <SelectListItem> GetListCateSelectItem()
        {
            var _factory = new CMSCategoriesFactory();
            List <SelectListItem> data = null;

            var listCate = _factory.GetList();

            if (listCate != null)
            {
                data = listCate.Select(x => new SelectListItem
                {
                    Value = x.Id,
                    Text  = x.CategoryName,
                }).ToList();
            }
            return(data);
        }
示例#6
0
 public CMSCategoriesController()
 {
     _factory         = new CMSCategoriesFactory();
     ViewBag.Category = GetListCategorySelectItem();
 }
示例#7
0
 public ShopController()
 {
     _fac      = new CMSProductFactory();
     _facCate  = new CMSCategoriesFactory();
     _facOrder = new CMSOrderFactory();
 }
示例#8
0
 public ProductController()
 {
     _fac     = new CMSProductFactory();
     _facCate = new CMSCategoriesFactory();
 }
示例#9
0
 public AboutController()
 {
     _facCate = new CMSCategoriesFactory();
     _facEmp  = new CMSEmployeeFactory();
     _facDis  = new CMSDiscountFactory();
 }