Exemplo n.º 1
0
        /// <summary>
        /// 添加一条记录
        /// </summary>
        public int Add(ProductImg entity, IDbTransaction tran)
        {
            string sql = @"insert into [ProductImg]
                               ([imgUrl], [productId], [orderId])
                               values
                               (@imgUrl, @productId, @orderId)";

            object param = new
            {
                imgUrl = entity.ImgUrl,
                productId = entity.ProductId,
                orderId = entity.OrderId
            };
            int count = tran.Connection.Execute(sql, param, tran);
            return count;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 添加一条记录
        /// </summary>
        public int Add(ProductImg entity)
        {
            string sql = @"insert into [ProductImg]
                               ([imgUrl], [productId], [orderId])
                               values
                               (@imgUrl, @productId, @orderId)";

            object param = new
            {
                imgUrl = entity.ImgUrl,
                productId = entity.ProductId,
                orderId = entity.OrderId
            };

            using (IDbConnection conn = OpenConnection())
            {
                int count = conn.Execute(sql, param);
                return count;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 添加一条记录
        /// </summary>
        public ResultSet Add(ProductImg entity)
        {
            Func<ProductImg, ResultStatus> validate = (_entity) =>
            {
                return new ResultStatus();
            };

            Func<ProductImg, ResultStatus> op = (_entity) =>
            {
                int ret = new ProductImgDal().Add(entity);
                if (ret > 0)
                    return new ResultStatus();
                else
                    return new ResultStatus()
                    {
                        Success = false,
                        Code = StatusCollection.AddFailed.Code,
                        Description = StatusCollection.AddFailed.Description
                    };
            };

            return HandleBusiness(entity, op, validate);
        }
Exemplo n.º 4
0
        public int Update(ProductImg entity)
        {
            //GetUpdateSql2
              string sql = @"update [ProductImg] set imgUrl=@imgUrl, productId=@productId, orderId=@orderId  where id=@id ";
               object param = new
            {
               id = entity.Id,
               imgUrl = entity.ImgUrl,
               productId = entity.ProductId,
               orderId = entity.OrderId
            };

            using (IDbConnection conn = OpenConnection())
            {
                int count = conn.Execute(sql, param);
                return count;
            }
        }