public static OrderProduct ItemById(ISession session, int id)
        {
            var cart  = ShoppingCartManager.GetCart(session);
            var order = cart.Order;

            if (order == null)
            {
                return(null);
            }
            var products = order.OrderProducts;

            if (products == null)
            {
                return(null);
            }
            return(products.FirstOrDefault(e => e.Id == id));
        }
        public static void AddItem(ISession session, OrderProduct item)
        {
            var cart = ShoppingCartManager.GetCart(session);

            var existingItem = cart.Order.OrderProducts.FirstOrDefault(e => e.Id == item.Id);

            if (existingItem != null)
            {
                int index = cart.Order.OrderProducts.IndexOf(existingItem);
                cart.Order.OrderProducts[index].IncrementQuantity();
            }
            else
            {
                cart.Order.OrderProducts.Add(item);
            }

            SaveCart(session, cart);
        }
 public static bool RemoveItem(ISession session, OrderProduct item)
 {
     return(ShoppingCartManager.RemoveItemById(session, item.Id));
 }