public ActionResult AddOrEdit(SettingViewModel model) { var item = new Setting(); if (model.Id > 0) { item = SettingService.Get(model.Id); } item = Mapper.Map(model, item); var result = SettingService.Save(item); return RedirectToAction("List"); }
public ActionResult AddOrEdit(SettingViewModel model) { var item = new Setting(); if (model.Id > 0) { item = Db.Get<Setting>(model.Id); } item = Mapper.Map(model, item); var result = Db.SaveOrUpdate(item); return RedirectToAction("List"); }
public Setting Save(Setting item) { Db.SaveOrUpdate(item); return item; }