Esempio n. 1
0
    protected void btnAddBasket_Click(object sender, EventArgs e)
    {
        ShoppingBasket basket = ShoppingBasket.GetBasket();
        BasketItem     item   = basket[hdnID.Value];

        if (item == null)
        {
            Product product = new Product
            {
                ID          = int.Parse(hdnID.Value),
                Title       = hdnTitle.Value,
                Description = hdnDescription.Value,
                Price       = decimal.Parse(hdnPrice.Value),
                ImagePath   = hdnImage.Value
            };
            basket.AddItem(product, 1);
        }
        else
        {
            item.AddQuantity(1);
        }
        Response.Redirect("Basket.aspx");
    }