private void AddEventToCart(Event currentEvent)
        {
            CatalogManager catalog = new CatalogManager();
            Product        product = catalog.GetProduct(ProductId);

            HttpCookie     cookie        = HttpContext.Current.Request.Cookies.Get("shoppingCartId");
            OrdersManager  orderm        = new OrdersManager();
            OptionsDetails optionDetails = new OptionsDetails();

            // Check if shopping cart cookie exists in the current request.
            if (cookie == null)                                               //if it does not exist...
            {
                CartOrder  cartItem       = orderm.CreateCartOrder();         //create a new cart order
                var        shoppingcartid = cartItem.Id;                      // that id is equal to the cookie value
                HttpCookie Cookie         = new HttpCookie("shoppingCartId"); //create a new shopping cart cookie
                DateTime   now            = DateTime.Now;                     // Set the cookie value.
                Cookie.Value   = shoppingcartid.ToString();                   // Set the cookie expiration date.
                Cookie.Expires = now.AddYears(1);                             // Add the cookie.
                HttpContext.Current.Response.Cookies.Add(Cookie);             //give cart item currency of USD because it cannot be null
                cartItem.Currency = "USD";                                    //add the product to the cart
                orderm.AddToCart(cartItem, product, optionDetails, 1);        //save all changes
                orderm.SaveChanges();
            }
            else //if the cookie does exist
            {
                Guid      guid     = new Guid(cookie.Value.ToString()); //get the cookie value as the guid
                CartOrder cartItem = orderm.GetCartOrder(guid);        //get the cart based on the cookie value
                orderm.AddToCart(cartItem, product, optionDetails, 1); // add the item to the cart
                orderm.SaveChanges();                                  //save changes
            }
        }
        private void AddEventToCart(Event currentEvent)
        {
            CatalogManager catalog = new CatalogManager();
            Product product = catalog.GetProduct(ProductId);

            HttpCookie cookie = HttpContext.Current.Request.Cookies.Get("shoppingCartId");
            OrdersManager orderm = new OrdersManager();
            OptionsDetails optionDetails = new OptionsDetails();

            // Check if shopping cart cookie exists in the current request.
            if (cookie == null) //if it does not exist...
            {
                CartOrder cartItem = orderm.CreateCartOrder(); //create a new cart order
                var shoppingcartid = cartItem.Id;  // that id is equal to the cookie value
                HttpCookie Cookie = new HttpCookie("shoppingCartId");  //create a new shopping cart cookie
                DateTime now = DateTime.Now; // Set the cookie value.
                Cookie.Value = shoppingcartid.ToString(); // Set the cookie expiration date.
                Cookie.Expires = now.AddYears(1);// Add the cookie.
                HttpContext.Current.Response.Cookies.Add(Cookie);  //give cart item currency of USD because it cannot be null
                cartItem.Currency = "USD"; //add the product to the cart
                orderm.AddToCart(cartItem, product, optionDetails, 1); //save all changes
                orderm.SaveChanges();
            }
            else //if the cookie does exist
            {
                Guid guid = new Guid(cookie.Value.ToString()); //get the cookie value as the guid
                CartOrder cartItem = orderm.GetCartOrder(guid); //get the cart based on the cookie value
                orderm.AddToCart(cartItem, product, optionDetails, 1); // add the item to the cart
                orderm.SaveChanges(); //save changes
            }
        }