Пример #1
0
 private void GetFilters()
 {
     Framework.Articles ar = new Framework.Articles();
     ViewBag.BagWidth      = ar.loadDimensionWidth();
     ViewBag.BagProfile    = ar.loadDimensionProfile();
     ViewBag.BagDiameter   = ar.loadDimensionDiameter();
     ViewBag.BagCategories = ar.loadCategories();
     ViewBag.BagBrands     = ar.loadBrands();
 }
Пример #2
0
        private List <Models.Products> GetProducts(int?sizeWidth, int?profile, int?sizeDiameter, int?idCategory, Guid?idBrand, bool?isCardView, ProductsCardsSortMode?sortMode)
        {
            Framework.Articles articles = new Framework.Articles();
            var articlesResult          = articles.loadProducts(idCategory, sizeWidth, profile, sizeDiameter, idBrand);

            var resultModel = (from p in articlesResult
                               select new Models.Products
            {
                Id = p.Id,
                Image = validaImage(p.Image),
                CatId = p.CatId,
                CategoryImage = GetImageCategory(p.CatId),                  //p.CategoryImage,
                CategoryName = GetNameCategory(p.CatId),                    //p.CategoryName,
                Brand = string.IsNullOrEmpty(p.Brand) ? "GENERAL": p.Brand.ToUpper(),
                BrandImage = validaImage(p.BrandImage),
                Name = p.Name,
                Description = p.Description,
                Width = p.Width,
                Profile = p.Profile,
                Diameter = p.Diameter,
                TyreSize = p.TyreSize,
                Fuel = string.IsNullOrEmpty(p.Fuel)? "&emsp;": p.Fuel,
                Wet = string.IsNullOrEmpty(p.Wet) ? "&emsp;" : p.Wet,
                Noise = string.IsNullOrEmpty(p.Noise) ? "&emsp;" : p.Noise,
                Price = p.Price,
                Stock = p.Stock,
                SpeedIndex = p.SpeedIndex,
                LoadIndex = p.LoadIndex
            }
                               ).ToList();


            if (sortMode == ProductsCardsSortMode.LowestHighest)
            {
                resultModel = resultModel.OrderBy(c => c.Price).ToList();
            }
            else
            {
                resultModel = resultModel.OrderByDescending(c => c.Price).ToList();
            }



            return(resultModel);
        }