Пример #1
0
        /// <summary>
        /// 创建购物车
        /// </summary>
        /// <param name="shopCart"></param>
        /// <returns></returns>
        public bool CreateShopCart(ShopCart shopCart)
        {
            string key = "ShopCart_" + shopCart.CustomerID.ToString();

            if (!_IRedisServer.KeyExists(key))
            {
                return(_IRedisServer.SetStringKey(key, shopCart));
            }
            else
            {
                throw new Exception("用户购物车已存在!");
            }
        }