/// <summary>
        /// 传递拉姆达表达式删除
        /// </summary>
        /// <param name="predicate"></param>
        /// <returns></returns>
        public virtual int Delete(Expression <Func <TEntity, bool> > predicate)
        {
            using (erp_1807Entities db = new erp_1807Entities())
            {
                var mm = db.Set <TEntity>().FirstOrDefault(predicate);

                db.Set <TEntity>().Remove(mm);

                db.Entry <TEntity>(mm).State = System.Data.Entity.EntityState.Deleted;

                db.SaveChanges();

                return(1);
            }
        }
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public virtual int Update(Expression <Func <TEntity, bool> > predicate, TEntity entity)
        {
            using (erp_1807Entities db = new erp_1807Entities())
            {
                var Entity = db.Set <TEntity>().FirstOrDefault(predicate);

                if (Entity != null)
                {
                    db.Entry <TEntity>(entity).State = System.Data.Entity.EntityState.Modified;
                    return(db.SaveChanges());
                }
                else
                {
                    return(0);
                }
            }
        }