public bool Delete(SettingEntity entity) { try { _settingRepository.Delete(entity); return true; } catch (Exception e) { _log.Error(e,"数据库操作出错"); return false; } }
public SettingEntity Update (SettingEntity entity) { try { _settingRepository.Update(entity); return entity; } catch (Exception e) { _log.Error(e,"数据库操作出错"); return null; } }
public bool CreateOrUpdateEntity(SettingEntity[] settings) { try { _settingRepository.AddOrUpdate(settings); return true; } catch (Exception e) { _log.Error(e, "数据库操作出错"); return false; } }
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, "数据添加失败")); } }