protected void Page_Load(object sender, EventArgs e) { string rawId = Request.QueryString["ItemId"]; int itemId; if (!String.IsNullOrEmpty(rawId) && int.TryParse(rawId, out itemId)) { ShoppingCartActions usersShoppingCart = new ShoppingCartActions(); usersShoppingCart.AddToCart(Convert.ToInt16(rawId)); } else { Debug.Fail("ERROR : We should never get to AddToCart.aspx without a ItemId."); throw new Exception("ERROR : It is illegal to load AddToCart.aspx without setting a ItemId."); } Response.Redirect("ShoppingCart.aspx"); }
public List<SalesItem> GetShoppingCartItems() { ShoppingCartActions actions = new ShoppingCartActions(); return actions.GetSalesCartItems(); }