public JsonResult Update(LanguageModel model) { Language currentLanguage; if (model.Id > 0) { currentLanguage = _settingService.GetLanguageById(model.Id); } else { currentLanguage = new Language(); } model.ToEntity(currentLanguage); var rs = _settingService.AddOrUpdate(currentLanguage); return(Json(rs)); }
public JsonResult Update(SettingModel model) { Setting currentSetting; if (model.Id > 0) { currentSetting = _settingService.GetSettingById(model.Id); } else { currentSetting = new Setting(); } model.ToEntity(currentSetting); var rs = _settingService.AddOrUpdate(currentSetting); return(Json(rs)); }
public JsonResult Update(FormCollection form) { List <LocaleResourceString> resources = new List <LocaleResourceString>(); var key = form["ResourceName"]; var langs = _settingService.GetAllLanguages(); foreach (var lang in langs) { var resource = new LocaleResourceString { LanguageId = lang.Id, ResourceName = key, ResourceValue = form[lang.Id.ToString()] }; resources.Add(resource); } var rs = _settingService.AddOrUpdate(resources); return(Json(rs)); }
public IHttpActionResult Post(setting setting) { _settingService.AddOrUpdate(setting, loggedInUserName: User.Identity.Name.Split('\\').LastOrDefault(), dontSave: false); return(Ok()); }