/**When user clicks "purchase", iterate through all items in customer's shopping cart and * send product id, product name, and unit price to shopping cart action file to create * 'purchased' event in Cosmos DB**/ protected void CheckoutBtn_Click(object sender, EventArgs e) { using (ShoppingCartActions usersShoppingCart = new ShoppingCartActions()) { foreach (var item in usersShoppingCart.GetCartItems()) { int productId = item.ProductId; string productName = item.Product.ProductName; double unitPrice = Convert.ToDouble(item.Product.UnitPrice); for (int k = 0; k < item.Quantity; k++) { usersShoppingCart.PurchaseProduct(productId, productName, unitPrice); } } usersShoppingCart.EmptyCart(); /**Redirect user to page that thanks them for their purchase**/ Response.Redirect("~/PurchasePage.aspx"); } }