public ActionResult SettingUpdate(SettingModel model) { if (model.Name != null) { model.Name = model.Name.Trim(); } if (model.Value != null) { model.Value = model.Value.Trim(); } if (!ModelState.IsValid) { return(Json(new DataSourceResult { Errors = ModelState.SerializeErrors() })); } var setting = _settingService.GetSettingById(model.Id); if (setting == null) { return(Content("找不到配置ID")); } setting = model.MapTo <SettingModel, Setting>(setting); _settingService.UpdateSetting(setting); return(new NullJsonResult()); }
public static Setting ToEntity(this SettingModel model, Setting destination) { return(model.MapTo(destination)); }
public static Setting ToEntity(this SettingModel model) { return(model.MapTo <SettingModel, Setting>()); }