Example #1
0
        /// <summary>
        /// 删除操作
        /// </summary>
        /// <param name="shoppingCartItems">购物车BE</param>
        public void Del(ShoppingCartItems shoppingCartItems)
        {
            ContextSession contextSession = ContextFactory.CurrentThreadContext;

            shoppingCartItems.EntityState = System.Data.EntityState.Deleted;
            contextSession.Delete(shoppingCartItems);
            contextSession.SaveChange();
        }
Example #2
0
        /// <summary>
        /// 添加操作
        /// </summary>
        /// <param name="shoppingCartItemsDTO">购物车实体</param>
        public void Add(ShoppingCartItemsDTO shoppingCartItemsDTO)
        {
            ShoppingCartItems shoppingCartItems = new ShoppingCartItems().FromEntityData(shoppingCartItemsDTO);
            ContextSession    contextSession    = ContextFactory.CurrentThreadContext;

            shoppingCartItems.EntityState = System.Data.EntityState.Added;
            contextSession.SaveObject(shoppingCartItems);
            contextSession.SaveChanges();
        }
Example #3
0
        /// <summary>
        /// 修改操作
        /// </summary>
        /// <param name="shoppingCartItemsDTO">购物车实体</param>
        public void Updates(ShoppingCartItemsDTO shoppingCartItemsDTO)
        {
            ContextSession contextSession = ContextFactory.CurrentThreadContext;

            shoppingCartItemsDTO.EntityState = System.Data.EntityState.Modified;
            ShoppingCartItems commodity = new ShoppingCartItems().FromEntityData(shoppingCartItemsDTO);

            contextSession.SaveObject(commodity);
            contextSession.SaveChanges();
        }