コード例 #1
0
        public ActionResult Buy(int productId)
        {
            DataCollector.BuyProduct(productId);
            var ids    = Request.Cookies["cart"]["productsIds"];
            var idsArr = ids.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

            Response.Cookies["cart"]["productsIds"] = string.Empty;
            foreach (var id in idsArr)
            {
                if (id != productId.ToString())
                {
                    Response.Cookies["cart"]["productsIds"] += id + ",";
                }
            }
            return(Redirect(Request.UrlReferrer.ToString()));
        }