Esempio n. 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)));
        }
Esempio n. 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);
        }
Esempio n. 3
0
 public static IEnumerable <DropDownlistItem> ProductBrands()
 {
     return(ProductBrand.All().Select(c => new DropDownlistItem(c.Id.ToString(), c.Name)));
 }
        public static IEnumerable <ProductBrand> All(Func <ProductBrand, bool> filter)
        {
            ProductBrand brand = new ProductBrand();

            return(brand.Repository.All(filter));
        }
        public static IEnumerable <ProductBrand> All()
        {
            ProductBrand brand = new ProductBrand();

            return(brand.Repository.All());
        }
        public static ProductBrand GetById(int brandId)
        {
            ProductBrand product = new ProductBrand();

            return(product.Repository.GetById(brandId));
        }