public ActionResult DeleteProductFromCompare(int id) { var cookie = Request.Cookies["TGZ_COMPARE_LIST"]; if (cookie != null) { for (int i = 0; i < cookie.Values.Count; i++) { var arr = cookie.Values.GetValues(i); if (arr[0] == id.ToString()) { var key = cookie.Values.GetKey(i); cookie.Values.Remove(key); break; } } if (cookie.Values.Count == 0) { cookie.Expires = DateTime.Now.AddDays(-1); } Response.Cookies.Add(cookie); } var arrValue = Utils.GetCookieValueAsStringArrayByCookie(cookie); var model = new ProductCompareModel(db); model.Initialize(arrValue); return PartialView("CompareProductPartial",model); }
public ActionResult CompareProductPartial() { var arrValue = Utils.GetCookieValueAsStringArray("TGZ_COMPARE_LIST"); var model = new ProductCompareModel(db); model.Initialize(arrValue); return PartialView(model); }