Beispiel #1
0
        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());
        }
Beispiel #2
0
 public static Setting ToEntity(this SettingModel model, Setting destination)
 {
     return(model.MapTo(destination));
 }
Beispiel #3
0
 public static Setting ToEntity(this SettingModel model)
 {
     return(model.MapTo <SettingModel, Setting>());
 }