public ActionResult Add(SettingDTO setting) { if (SessionCache.UserId != null) { ViewBag.ValidationError = TempData["ValidationError"]; return View("Add", setting); } else { return RedirectToAction("Index", "Login"); } }
public ActionResult Create(SettingDTO setting) { if (SessionCache.UserId != null) { string error = ""; if (error.Length == 0) { settingService.Save(setting); return RedirectToAction("Success", "Setting", new { message = "Successfully saved the Setting." }); } else { TempData["ValidationError"] = error; return RedirectToAction("Add", "Setting", setting); } } else { return RedirectToAction("Index", "Login"); } }
public ActionResult Delete(SettingDTO setting, int? id) { if (SessionCache.UserId != null) { string error = ""; if (error.Length == 0) { setting = settingService.GetSetting(setting.Id); settingService.Delete(setting); return View("Success", (object)"Setting deleted successfully."); } else { return Redirect((string)ViewData["DeleteReturn"]); } } else { return RedirectToAction("Index", "Login"); } }
public void Save(SettingDTO obj) { settingRepository.Save(Mapper.Map<SettingDTO, Setting>(obj)); }
public void Delete(SettingDTO obj) { settingRepository.Delete(Mapper.Map<SettingDTO, Setting>(obj)); }