public ActionResult LoadLeftSideBarSearch() { var categoryList = _categoryBusiness.GetListWT(); var subCategoryList = _subCategoryBusiness.GetListWT(); Mapper.CreateMap <SubCategory, SubCategoryViewModel>(); var vmSubCategoryList = Mapper.Map <List <SubCategory>, List <SubCategoryViewModel> >(subCategoryList); var vmCategoryList = (from c in categoryList select new CategoryViewModel { CategoryId = c.CategoryId, TokenKey = c.TokenKey, CategoryName = c.CategoryName, subCategoryList = vmSubCategoryList.Where(sc => sc.CategoryId == c.CategoryId).ToList() }).ToList(); LeftSideBarViewModel leftSideBarViewModel = new LeftSideBarViewModel(); leftSideBarViewModel.categoryList = vmCategoryList; leftSideBarViewModel.ColorList = _productBusiness.Getcolor().Select(x => new SelectListItem { Text = x.Text.ToString(), Value = x.Value.ToString() }).ToList(); return(PartialView("_LoadLeftSideBarSearch", leftSideBarViewModel)); }
public ActionResult LoadLeftSideBar() { var categoryid = Convert.ToInt32(string.IsNullOrEmpty(Request.QueryString["categoryid"]) ? "0" : Request.QueryString["categoryid"].ToString()); var subcategoryid = Convert.ToInt32(string.IsNullOrEmpty(Request.QueryString["subcategoryid"]) ? "0" : Request.QueryString["subcategoryid"].ToString()); var categoryList = _categoryBusiness.GetListWT(); if (categoryid == 0) { var subCategory = _subCategoryBusiness.GetListWT(c => c.SubCategoryId == subcategoryid).FirstOrDefault(); if (subCategory != null) { categoryid = subCategory.CategoryId; } } var category = _categoryBusiness.GetListWT(c => c.CategoryId == categoryid).FirstOrDefault(); var subCategoryList = _subCategoryBusiness.GetListWT(c => c.CategoryId == categoryid); var vmCategoryList = (from c in categoryList select new CategoryViewModel { CategoryId = c.CategoryId, TokenKey = c.TokenKey, CategoryName = c.CategoryName, }).ToList(); Mapper.CreateMap <Category, CategoryViewModel>(); var vmCategory = Mapper.Map <Category, CategoryViewModel>(category); Mapper.CreateMap <SubCategory, SubCategoryViewModel>(); var vmSubCategoryList = Mapper.Map <List <SubCategory>, List <SubCategoryViewModel> >(subCategoryList); var brandList = _brandBusiness.GetListWT(c => c.CategoryId == categoryid); var productList = _productBusiness.GetListWT(); var vmbrandList = (from c in brandList select new BrandViewModel { BrandId = c.BrandId, TokenKey = c.TokenKey, BrandName = c.BrandName, ProductCount = productList.Where(p => p.BrandId == c.BrandId).Count() }).ToList(); LeftSideBarViewModel leftSideBarViewModel = new LeftSideBarViewModel(); leftSideBarViewModel.category = vmCategory; leftSideBarViewModel.categoryList = vmCategoryList; leftSideBarViewModel.subCategoryList = vmSubCategoryList; leftSideBarViewModel.BrandList = vmbrandList; leftSideBarViewModel.ColorList = _productBusiness.Getcolor().Select(x => new SelectListItem { Text = x.Text.ToString(), Value = x.Value.ToString() }).ToList(); return(PartialView("_LoadLeftSideBar", leftSideBarViewModel)); }
public PartialViewResult LeftSideBar() { var viewModel = new LeftSideBarViewModel { Catalogs = _catalogAppService.GetParentCatalogs(), Menu = AsyncHelper.RunSync( () => _userNavigationManager.GetMenuAsync(MainMenuName, AbpSession.ToUserIdentifier())) }; return(PartialView("_LeftSideBar", viewModel)); }
public ActionResult LoadLeftSideBarHome() { var categoryList = _categoryBusiness.GetListWT(); var subCategoryList = _subCategoryBusiness.GetListWT(); Mapper.CreateMap <SubCategory, SubCategoryViewModel>(); var vmSubCategoryList = Mapper.Map <List <SubCategory>, List <SubCategoryViewModel> >(subCategoryList); var vmCategoryList = (from c in categoryList select new CategoryViewModel { CategoryId = c.CategoryId, TokenKey = c.TokenKey, CategoryName = c.CategoryName, subCategoryList = vmSubCategoryList.Where(sc => sc.CategoryId == c.CategoryId).ToList() }).ToList(); LeftSideBarViewModel leftSideBarViewModel = new LeftSideBarViewModel(); leftSideBarViewModel.categoryList = vmCategoryList; return(PartialView("_LoadLeftSideBarHome", leftSideBarViewModel)); }