public ActionResult compare() { pc = TempData["compareList"] as productCompare; if (pc.getCompareList().Count > 0) { pc.setCategoryName(); pc.setSubcategoryName(); } return(View(pc)); }
public ActionResult compareProducts(FormCollection fc) { //listEngine = TempData["outputList"] as productList; productCompare pc = new productCompare(new unitOfWork(new KEY_TeamMVCEntities())); List <tblProduct> list = new List <tblProduct>(); //var id1 = fc.GetValue("product1").AttemptedValue; //var id2 = fc.GetValue("product2").AttemptedValue; //var id3 = fc.GetValue("product3").AttemptedValue; foreach (var product in productList) { if (fc.GetValue("product" + product.ID).AttemptedValue.Contains("true")) { list.Add(pc.getUOW().getProductRepo().get(product.ID)); } } pc.setCompareList(list); TempData["compareList"] = pc; return(RedirectToAction("compare", "Compare")); }