Example #1
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="entity">新增的实体</param>
        /// <param name="bSubmit">是否提交</param>
        /// <returns>成功返回true,失败返回false</returns>
        public bool Insert <T>(T entity, bool bSubmit = false) where T : Entity
        {
            context.Set <T>().Add(entity);

            if (bSubmit)
            {
                return(context.SaveChanges() > 0);
            }
            return(true);
        }
Example #2
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="entity">新增的实体</param>
        /// <param name="bSubmit">是否提交</param>
        /// <returns>成功返回true,失败返回false</returns>
        public bool Insert(T entity, bool bSubmit = false)
        {
            dbSet.Add(entity);

            if (bSubmit)
            {
                return(context.SaveChanges() > 0);
            }
            return(true);
        }
Example #3
0
 public bool Commit()
 {
     return(_dbContext.SaveChanges() > 0);
 }