public async Task <IActionResult> PostSheetAsync([FromBody] AddSheetDto dto)
        {
            try
            {
                var data = await _payServices.PostSheetAsync(dto);

                return(AddSuccessMsg());
            }
            catch (Exception err)
            {
                _logger.Error(typeof(WxPayController), "添加失败!", new Exception(err.Message));
                return(FailedMsg("添加失败! " + err.Message));
            }
        }
        /// <summary>
        /// 新增附件
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public async Task <bool> PostSheetAsync(AddSheetDto dto)
        {
            Sheet sheet = iMapper.Map <Sheet>(dto); // 附件

            List <Sheet> sheets = new List <Sheet>();

            string[] imgArray = dto.ImgNames.Split(','); //字符串转数组
            foreach (var img in imgArray)
            {
                sheet.ID        = IdHelper.CreateGuid();
                sheet.ImgUrl    = ImgConfig.img_url + img;
                sheet.IsDeleted = false;
                sheets.Add(sheet);
            }

            var result = 0;

            return(await Task.Run(() =>
            {
                result = db.Insertable(sheets).ExecuteCommand();

                return result > 0;
            }));
        }
Exemple #3
0
 /// <summary>
 /// 新增附件
 /// </summary>
 /// <param name="dto"></param>
 /// <returns></returns>
 public async Task <bool> PostSheetAsync(AddSheetDto dto)
 {
     return(await _wxpayDal.PostSheetAsync(dto));
 }