Ejemplo n.º 1
0
        /// <summary>
        /// 保存支付配置信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public OpResult SaveModel(SysPaymentSetting model)
        {
            var result = OpResult.Fail("数据保存失败!");

            try
            {
                if (_dal.ExistsById(model.Id))
                {
                    var re = _dal.Update(model);
                    if (re)
                    {
                        result = OpResult.Success("数据保存成功");
                    }
                }
                else
                {
                    var re = _dal.Insert(model);
                    if (re > 0)
                    {
                        result = OpResult.Success("数据保存成功");
                    }
                }
            }
            catch (Exception ex)
            {
                result = OpResult.Fail("数据保存失败!" + ex.Message);
            }
            return(result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 根据Id获取支付配置信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public SysPaymentSetting GetModel(int id)
        {
            var data = _dal.GetById(id);

            if (data == null)
            {
                data       = new SysPaymentSetting();
                data.State = 1;
            }
            return(data);
        }