Exemple #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     string rawId = Request.QueryString["ProductId"];
     int productId;
     if (!string.IsNullOrEmpty(rawId))
     {
         using (ShoppingCartActions usersShopingCart = new ShoppingCartActions())
         {
             usersShopingCart.AddToCart(Convert.ToInt16(rawId));
         }
     }
     else
     {
         Debug.Fail("ERROR : We should never get to AddToCart.aspx without a ProductId.");
         throw new Exception("ERROR : It is illegal to load AddToCart.aspx without setting a ProductId.");
     }
     Response.Redirect("ShoppingCart.aspx");
 }
Exemple #2
0
 public List<CartItem> GetShoppingCartItems()
 {
     ShoppingCartActions actions = new ShoppingCartActions();
     return actions.GetCartItems();
 }