public virtual ActionResult Statistics() { var model = new SideBarModel { BookCount = _bookService.Count, CommentCount = _commentService.Count, UserCount = _userService.Count }; return(PartialView(MVC.SideBar.Views._Statistics, model)); }
public IViewComponentResult Invoke() { var category = new SideBarModel(); category.Materials = _material.GetMaterials; category.ProductModels = _models.GetModels; category.TypeOfProducts = _types.GetTypeOfProducts; category.Producers = _producers.GetProducers; category.MaxPrice = Convert.ToInt32(_products.GetProducts.Max(p => p.Price)); category.MinPrice = Convert.ToInt32(_products.GetProducts.Min(p => p.Price)); return(View(category)); }
public ActionResult GetRandomPhoto() { var photo = _photoService.GetRandomPhoto(); var model = new SideBarModel() { Photo = photo, Tags = _tagService.GetAll() }; if (Request.Browser.IsMobileDevice) { return(PartialView("~/Views/Gallery/_Mobile.cshtml", model)); } return(PartialView("~/Views/Shared/_SideBar.cshtml", model)); }
public SideBarModel generateSideBar(int?subSection, int?section) { SideBarModel model = new SideBarModel(); model.brands = new List <Brand>(); model.categories = new List <CategoryModel>(); if (subSection != null && subSection > 0) { foreach (var categ in setzDB.Categories.Where(c => c.SubSectionID == subSection)) { CategoryModel categoryModel = new CategoryModel(); categoryModel.category = categ; categoryModel.subCategories = new List <SubCategory>(); foreach (var subc in setzDB.SubCategories.Where(s => s.CategoryID == categ.ID)) { categoryModel.subCategories.Add(subc); } model.categories.Add(categoryModel); } } else { foreach (var subs in setzDB.SubSections.Where(s => s.SectionID == section)) { foreach (var categ in setzDB.Categories.Where(c => c.SubSectionID == subs.ID)) { CategoryModel categoryModel = new CategoryModel(); categoryModel.category = categ; categoryModel.subCategories = new List <SubCategory>(); foreach (var subc in setzDB.SubCategories.Where(s => s.CategoryID == categ.ID)) { categoryModel.subCategories.Add(subc); } model.categories.Add(categoryModel); } } } model.brands = setzDB.Brands.OrderByDescending(b => b.ID).Take(10).ToList(); return(model); }
public IActionResult Catalog(SideBarModel sm) { CatalogModel obj = new CatalogModel(); LayoutViewModel layoutModel = new LayoutViewModel(); obj.LayoutModel = layoutModel; int min, max; if (sm.FirstPrice > sm.SecondPrice) { min = sm.SecondPrice; max = sm.FirstPrice; } else { max = sm.SecondPrice; min = sm.FirstPrice; } obj.GetProducts = _products.GetProducts.Where(t => (t.Price - (t.Price / 100 * t.SalePercent)) >= min && (t.Price - (t.Price / 100 * t.SalePercent)) <= max).ToList(); obj.ProductsCount = obj.GetProducts.Count(); obj.GetProductImages = _productImages.GetProductImages.ToList(); obj.ProductImagesCount = _productImages.GetProductImages.Count(); return(View(obj)); }