public ActionResult Edit(SettingModel model) { if (ModelState.IsValid) { var entity = _settingService.GetSettingById(model.Id); if (entity == null) { return(RedirectToAction("List")); } entity = model.ToEntity(entity); _settingService.UpdateSetting(entity); return(RedirectToAction("List").WithSuccess($"Setting - {entity.Name} - was updated successfully.")); } return(View(model)); }
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)); }