コード例 #1
0
 public ActionResult Add(SettingDTO setting)
 {
     if (SessionCache.UserId != null)
     {
         ViewBag.ValidationError = TempData["ValidationError"];
         return View("Add", setting);
     }
     else
     {
         return RedirectToAction("Index", "Login");
     }
 }
コード例 #2
0
        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");
            }
        }
コード例 #3
0
        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");
            }
        }
コード例 #4
0
 public void Save(SettingDTO obj)
 {
     settingRepository.Save(Mapper.Map<SettingDTO, Setting>(obj));
 }
コード例 #5
0
 public void Delete(SettingDTO obj)
 {
     settingRepository.Delete(Mapper.Map<SettingDTO, Setting>(obj));
 }