Exemple #1
0
 public ActionResult SaveHelpTelInfo([FromBody] WctHelpTelMstrDto helpDto)
 {
     try
     {
         var result = _wctHelpTelMstrService.SaveHelpTelInfo(helpDto);
         return(Success("保存成功", result));
     }
     catch (Exception ex)
     {
         return(Fail("保存失败:" + ex.Message));
     }
 }
        /// <summary>
        /// 编辑/新增救援信息
        /// </summary>
        /// <param name="helpDto"></param>
        /// <returns></returns>
        public WctHelpTelMstr SaveHelpTelInfo(WctHelpTelMstrDto helpDto)
        {
            try
            {
                WctHelpTelMstr mstr = null;
                if (string.IsNullOrEmpty(helpDto.Id))
                {
                    #region 参数验证
                    if (string.IsNullOrEmpty(helpDto.TEL_NAME))
                    {
                        throw new Exception("号码归属不能为空");
                    }
                    if (string.IsNullOrEmpty(helpDto.TEL_NO))
                    {
                        throw new Exception("电话号码不能为空");
                    }
                    if (string.IsNullOrEmpty(helpDto.TEL_TYPE))
                    {
                        throw new Exception("电话类型不能为空");
                    }
                    #endregion

                    //新增
                    helpDto.Id        = Guid.NewGuid().ToString("N");
                    helpDto.TEL_ID_NO = AbpSession.ORG_NO;
                    _initHelper.InitAdd <WctHelpTelMstrDto>(helpDto, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);

                    mstr = _wctHelpTelMstrRepository.Insert(helpDto.ToEntity());
                }
                else
                {
                    //修改
                    _initHelper.InitUpdate <WctHelpTelMstrDto>(helpDto, AbpSession.USR_ID);
                    mstr = _wctHelpTelMstrRepository.Update(helpDto.ToEntity());
                }
                return(mstr);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }