Exemplo n.º 1
0
        /// <summary>
        /// 删除购物车中的商品信息
        /// </summary>
        /// <param name="shoppingCartId">购物车ID</param>
        /// <returns></returns>
        public bool DeleteShoppingCartByProductIdUserID(int shoppingCartId)
        {
            var holycaDb = new HolycaEntities();

            Sale_ShoppingCart queryTxt = holycaDb.Sale_ShoppingCart.Where(c => c.intShopCartID == shoppingCartId).FirstOrDefault();

            holycaDb.DeleteObject(queryTxt);

            holycaDb.SaveChanges();

            return(true);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 增加购物车商品信息
        /// </summary>
        /// <param name="shoppingCartEntity">购物车信息实体</param>
        /// <returns></returns>
        public bool AddShoppingCartProductInfo(ShoppingCartEntity shoppingCartEntity)
        {
            var holycaDb = new HolycaEntities();
            Sale_ShoppingCart sale_ShoppingCart = new Sale_ShoppingCart();

            MCvHelper.ObjectCopyTo(shoppingCartEntity, sale_ShoppingCart);
            try
            {
                holycaDb.Sale_ShoppingCart.AddObject(sale_ShoppingCart);
                holycaDb.SaveChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }