Esempio n. 1
0
        public List <CategoryAppIG4Item> GetChildByParentId(bool setTitle, int type = 0)
        {
            var cate = from c in FDIDB.Category_GetList(LanguageId)
                       select new CategoryAppIG4Item
            {
                ID       = c.Id,
                ParentId = c.ParentId,
                Name     = c.Name,
                Slug     = c.NameRoot,
                Type     = c.Type,
                IsLevel  = c.IsLevel
            };

            if (type != 0)
            {
                cate = cate.Where(c => c.Type == type);
            }
            var re = cate.ToList();

            if (setTitle)
            {
                re.Insert(0, new CategoryAppIG4Item {
                    ID = 0, Name = "-- Chọn chuyên mục --"
                });
            }
            return(re);
        }
Esempio n. 2
0
        public List <CategoryItem> GetChildByParentId(bool setTitle)
        {
            var cate = from c in FDIDB.Category_GetList(LanguageId)
                       select new CategoryItem
            {
                ID               = c.Id,
                ParentId         = c.ParentId,
                Name             = c.Name,
                Slug             = c.NameRoot,
                Type             = c.Type,
                IsLevel          = c.IsLevel,
                Price            = c.Price,
                PriceRecipeFinal = c.PriceRecipeFinal,
                PriceFinal       = c.PriceFinal,
                PercentLoss      = c.PercentLoss,
                WeightDefault    = c.WeightDefault,
            };

            var re = cate.ToList();

            if (setTitle)
            {
                re.Insert(0, new CategoryItem {
                    ID = 0, Name = "-- Chọn chuyên mục --"
                });
            }
            return(re);
        }
Esempio n. 3
0
        public List <CategoryItem> GetChildCategories(int type)
        {
            var query = from c in FDIDB.Category_GetList(LanguageId)
                        orderby c.Id descending
                        select new CategoryItem
            {
                ID       = c.Id,
                ParentId = c.ParentId,
                Name     = c.Name,
                Slug     = c.NameRoot,
                Type     = c.Type,
                IsLevel  = c.IsLevel,
            };

            if (type != 0)
            {
                query = query.Where(c => c.Type == type);
            }
            return(query.ToList());
        }