Ejemplo n.º 1
0
 public HttpResponseMessage Detailed(int id)
 {
     var setting = _settingService.GetSettingById(id);
     if (setting == null)
     {
         return PageHelper.toJson(PageHelper.ReturnValue(false, "该数据不存在"));
     }
     var settingDetail = new SettingModel
     {
         Key = setting.Key,
         Value = setting.Value
     };
     return PageHelper.toJson(settingDetail);
 }
Ejemplo n.º 2
0
 public HttpResponseMessage Create(SettingModel model)
 {
     if (string.IsNullOrEmpty(model.Value))
     {
         return PageHelper.toJson(PageHelper.ReturnValue(false, "数据不允许为空!"));
     }
     var setting = new SettingEntity
     {
         Key = model.Key,
         Value = model.Value
     };
     if (_settingService.Create(setting) != null)
     {
         return PageHelper.toJson(PageHelper.ReturnValue(true, "数据添加成功"));
     }
     else
     {
         return PageHelper.toJson(PageHelper.ReturnValue(false, "数据添加失败"));
     }
 }