public ActionResult NewSetting(NewSettingViewModel model) { try { _settingsManagement.AddOrUpdate(model.Setting); this.SuccessMessage($"Setting <b>({model.Setting.Name})</b> has been saved!"); } catch (Exception e) { this.ErrorMessage($"Setting <b>({model.Setting.Name})</b> could not saved! ({e.Message})"); } return(RedirectToAction("Index")); }
public ActionResult NewSetting(int?id) { NewSettingViewModel model = new NewSettingViewModel(); if (id == null) { model.Setting = new Settings(); } else { model.Setting = _settingsManagement.Get(s => s.ID == id); } return(View(model)); }