public ActionResult Index(int pageId) { var helperPage = new helperProductList(); // mainProductUrl pageShared ps = new pageShared(db); var item = ps.getPageById(pageId); helperPage.breadCrumbItem = getIndexBreadCrumbProductList(item.name); helperPage.header = item.name; var newProductList = db.tbl_product.Include("tbl_stock").Include("tbl_gallery").Include("tbl_carModelProduct.tbl_carModel.tbl_carBrand").Where(a => a.statu && a.isDeleted == false && a.tbl_stock.Any(b => b.stockCount > 0) && a.tbl_carModelProduct.Any(c => c.tbl_carModel != null) && a.tbl_carModelProduct.Any(c => c.tbl_carModel != null) && a.tbl_carModelProduct.Any(c => c.tbl_carModel.tbl_carBrand != null) && a.langId == langId).OrderByDescending(a => a.sequence).ToList(); productShared pc = new productShared(db); int productCount = newProductList.Count; int currentPage = pc.getCurrentPage(Request, productCount, 6); helperPage.pagingItem = pc.getPageItem(productCount, currentPage, 6, "?sayfa="); helperPage.productList = pc.getProductSummary(item.url, newProductList.Skip((currentPage - 1) * 6).Take(6).ToList(), langCulture, langCode, "240", "160"); // Title ps.pageTitleBind(item, helperPage, langId); return View(helperPage); }
public ActionResult BrandSelect(int carBrandId, string parentUrl, string parentName) { var helperPage = new helperBrandSelectProductList(); var carBrand = db.tbl_carBrand.Include("tbl_carModel").Where(a => a.carBrandId == carBrandId).FirstOrDefault(); helperPage.breadCrumbItem = getBrandSelectBreadCrumbProductList(parentName, parentUrl, carBrand.name); helperPage.header = carBrand.name; if (!string.IsNullOrEmpty(carBrand.title)) { helperPage.header = carBrand.title; } helperPage.brandWithModelList = getBrandWithModelList(carBrand, parentUrl, null); //productList var productListWithBrandId = db.tbl_product.Include("tbl_stock").Include("tbl_gallery").Include("tbl_carModelProduct.tbl_carModel.tbl_carBrand").Where(a => a.statu && a.isDeleted == false && a.tbl_stock.Any(b => b.stockCount > 0) && a.tbl_carModelProduct.Any(c => c.tbl_carModel != null) && a.tbl_carModelProduct.Any(c => c.tbl_carModel != null) && a.tbl_carModelProduct.Any(c => c.tbl_carModel.tbl_carBrand != null) && a.tbl_carModelProduct.All(c => c.tbl_carModel.tbl_carBrand.carBrandId == carBrandId) && a.langId == langId).OrderBy(a => a.sequence).ToList(); productShared pc = new productShared(db); int productCount = productListWithBrandId.Count; int currentPage = pc.getCurrentPage(Request, productCount, 6); helperPage.pagingItem = pc.getPageItem(productCount, currentPage, 6, "?sayfa="); helperPage.productList = pc.getProductSummary(parentUrl, productListWithBrandId.Skip((currentPage - 1) * 6).Take(6).ToList(), langCulture, langCode, "240", "160"); // Title var settingItem = db.tbl_settings.Where(a => a.langId == langId).FirstOrDefault(); if (settingItem != null) { helperPage.setBrowserTitle(helperPage.header + settingItem.allPageTitle); } return View(helperPage); }
// New Product List private List<productSmall> getNewProductList(string productUrl) { var list = db.tbl_product.Include("tbl_stock").Include("tbl_gallery").Include("tbl_carModelProduct.tbl_carModel.tbl_carBrand").Where(a => a.isShowCase && a.statu && a.tbl_stock.Any(b => b.stockCount > 0) && a.tbl_carModelProduct.Any(c => c.tbl_carModel != null) && a.tbl_carModelProduct.Any(c => c.tbl_carModel != null) && a.tbl_carModelProduct.Any(c => c.tbl_carModel.tbl_carBrand != null) && a.langId == langId).Take(6).ToList(); productShared pc = new productShared(db); return pc.getProductSummary(productUrl, list, langCulture, langCode); }