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); }
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(); }
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); }
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); }
public CMSCategoriesController() { _factory = new CMSCategoriesFactory(); ViewBag.Category = GetListCategorySelectItem(); }
public ShopController() { _fac = new CMSProductFactory(); _facCate = new CMSCategoriesFactory(); _facOrder = new CMSOrderFactory(); }
public ProductController() { _fac = new CMSProductFactory(); _facCate = new CMSCategoriesFactory(); }
public AboutController() { _facCate = new CMSCategoriesFactory(); _facEmp = new CMSEmployeeFactory(); _facDis = new CMSDiscountFactory(); }