Beispiel #1
0
        public static IEnumerable <DropDownlistItem> ProductBrandsWithDescription()
        {
            var brandIds = Product.All()
                           .Select(p => p.BrandId).Distinct();

            return(brandIds.Select(id => ProductBrand.GetById(id))
                   .Select(c => new DropDownlistItem(c.Id.ToString(), c.Name)));
        }
Beispiel #2
0
        public static IEnumerable <DropDownlistItem> ProductBrands(int categoryId)
        {
            IEnumerable <int> brandIds = Product.All(p => p.CategoryId == categoryId).Select(item => item.BrandId);
            var brands = brandIds.Select(brandId => ProductBrand.GetById(brandId))
                         .Select(b => new DropDownlistItem(b.Id.ToString(), b.Name));

            return(brands);
        }