public void btn_AgregarClick(object sender, EventArgs e)
        {
            var         id   = int.Parse((sender as LinkButton).CommandArgument);
            ItemCarrito item = carr.Items.Find(x => x.Id == id);

            carr.AgregarItem(item);
            Session.Add("carrito", carr);
            Response.Redirect(Request.RawUrl);
        }
Beispiel #2
0
        public void btn_AgregarClick(object sender, EventArgs e)
        {
            var         id = int.Parse((sender as LinkButton).CommandArgument);
            Articulo    a  = listaArticulo.Find(x => x.Id == id);
            ItemCarrito i  = new ItemCarrito(a);

            if ((Carrito)Session["carrito"] == null)
            {
                carr.AgregarItem(i);
            }
            else
            {
                carr = (Carrito)Session["carrito"];
                carr.AgregarItem(i);
            }
            Session.Add("carrito", carr);
        }