using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;

namespace Mall.Cart
{
    public partial class CartMod : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            string id = Request.QueryString["id"] == null ? string.Empty : Request.QueryString["id"].ToString();
            string buylist = Request.Cookies["cart"].Value == "" ? string.Empty : Request.Cookies["cart"].Value.ToString();
            string[] buylists = buylist.Split(new char[] { ',' });
            StringBuilder str_cartn = new StringBuilder();
            string str_cart = string.Empty;
            foreach (string s in buylists)
            {

                string ido = s.Split(new string[] { "{$s$}" }, StringSplitOptions.None)[0].ToString();
                if (id != ido)
                {
                    str_cartn.Append(s);
                    str_cartn.Append(",");
                }


            }
            str_cart = str_cartn.ToString();
            str_cart = str_cart.Substring(0, str_cart.Length - 1);
            Response.Cookies["cart"].Value = str_cart;
            Response.Redirect("/cart/cart.aspx");
            //return RedirectToAction("cart", "cart");

        }
    }
}