Exemple #1
0
        public JsonResult SaveAppSetting(AppSettingDto appSettingDto)
        {
            ResponseResult responseResult;
            bool           isAdd = appSettingDto.Id == 0;

            try
            {
                var isConfiKeyExisted = ConfiKeyExisted(appSettingDto);
                if (isAdd)
                {
                    if (isConfiKeyExisted)
                    {
                        AppSettingBusiness.SaveAppSetting(appSettingDto);
                        responseResult = new ResponseResult(ResultEnum.IsSuccess.成功, "新增配置成功");
                    }
                    else
                    {
                        responseResult = new ResponseResult(ResultEnum.IsSuccess.失败, "已存在该项配置,请考虑清楚再添加!");
                    }
                }
                else
                {
                    AppSettingBusiness.SaveAppSetting(appSettingDto);
                    responseResult = new ResponseResult(ResultEnum.IsSuccess.成功, "新增配置成功");
                }
            }
            catch (Exception ex)
            {
                responseResult = new ResponseResult(ResultEnum.IsSuccess.失败, "添加配置异常,请联系管理员!" + appSettingDto.AppId);
            }
            return(Json(responseResult, JsonRequestBehavior.AllowGet));
        }
        public JsonResult SaveAppSetting(AppSettingDto appSettingDto)
        {
            ResponseResult responseResult;

            try
            {
                AppSettingBusiness.SaveAppSetting(appSettingDto);
                responseResult = new ResponseResult(true, "");
            }
            catch (Exception)
            {
                responseResult = new ResponseResult(false, "");
            }
            return(Json(responseResult, JsonRequestBehavior.AllowGet));
        }