private static string getCartID(int portalID) { string cartID = null; // Get cart ID from cookie HttpCookie cartCookie = HttpContext.Current.Request.Cookies[CartCookieName + portalID.ToString()]; if (cartCookie != null) { cartID = cartCookie["CartID"]; } // Do we need to verify? if ((cartID != null) && (!_isCartVerified)) { CartController controller = new CartController(); _isCartVerified = (controller.GetCart(cartID, portalID) != null); if (!_isCartVerified) { cartID = null; } } // Do we need to create a new cart? if (cartID == null) { cartID = createCart(portalID); setCartID(portalID, cartID); } return cartID; }
public static CartInfo GetInfo(int portalID) { string cartID = getCartID(portalID); CartController controller = new CartController(); CartInfo cartInfo = controller.GetCart(cartID, portalID); return cartInfo; }