コード例 #1
0
        /// <summary>
        /// 测试图片上传
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ResultModel <bool> TestUpLoadPicture(Enclosure model)
        {
            var result = new ResultModel <bool>();

            try
            {
                _enclosureRepository.BeginTran();  //开始事务
                result.Data = _enclosureRepository.Insert(model);
                _enclosureRepository.CommitTran(); //提交事务
                return(result);
            }
            catch (Exception ex)
            {
                _enclosureRepository.RollbackTran();//回滚事务
                throw ex;
            }
        }
コード例 #2
0
 /// <summary>
 /// 测试图片上传
 /// </summary>
 /// <param name="FilePath"></param>
 /// <returns></returns>
 public bool TestUpLoadEnclosure(string FilePath)
 {
     try
     {
         _enclosureRepository.BeginTran();//开始事务
         Enclosure Enclosure = new Enclosure();
         Enclosure.Id       = IdWorkerHelper.NewId();
         Enclosure.FilePath = FilePath;
         bool result = _enclosureRepository.Insert(Enclosure);
         _enclosureRepository.CommitTran();//提交事务
         return(result);
     }
     catch (Exception ex)
     {
         _enclosureRepository.RollbackTran();//回滚事务
         throw ex;
     }
 }