public ActionResult Index() { Home h = new Home(); h.Categories = CatService.GetAllCategories(); h.products = ProdService.GetAllproducts(); //h.Speicalproducts = return(View(h)); }
public ActionResult ProducTable(string Search) { var products = prodService.GetAllproducts(); foreach (var item in products) { item.Category = cateService.GetCategoryById(item.Cat_Id); } if (Search != null) { products = products.Where(p => p.Name != null && p.Name.ToLower().Contains(Search.ToLower())).ToList(); } return(PartialView(products)); }
// GET: AddToCart public ActionResult Index() { productService proService = new productService(); CategoryService cateService = new CategoryService(); var pro = Request.Cookies["Products"]; List <Product> products = null; if (pro != null) { var IDs = pro.Value; var ProIds = IDs.Split('-').Select(x => int.Parse(x)).ToList(); products = proService.GetAllproducts(ProIds); foreach (var item in products) { item.Category = cateService.GetCategoryById(item.Cat_Id); } } return(View(products)); }