コード例 #1
0
ファイル: SiteConfigController.cs プロジェクト: war-man/Cfood
        public ActionResult OnDelete(int id)
        {
            var result = SiteConfigService.Delete(id);

            SetFlashMessage(result == "ok" ?"Xóa cấu hình thành công.":"Cấu hình không tồn tại trên hệ thống.");
            return(RedirectToAction("Index"));
        }
コード例 #2
0
ファイル: SiteConfigController.cs プロジェクト: war-man/Cfood
        public ActionResult Edit(int id)
        {
            var config = SiteConfigService.Find(id);

            if (config == null)
            {
                return(RedirectToAction("Index"));
            }
            return(View("Edit", config.CloneTo <SiteConfigModels>()));
        }
コード例 #3
0
ファイル: SiteConfigController.cs プロジェクト: war-man/Cfood
 public ActionResult OnEdit(SiteConfigModels config)
 {
     if (ModelState.IsValid)
     {
         var result = SiteConfigService.Update(config.CloneTo <SiteConfig>());
         if (result == "not_exists")
         {
             ModelState.AddModelError("", "Cấu hình không tồn tại trên hệ thống.");
             return(View("Edit", config));
         }
         SetFlashMessage(string.Format("Sửa cấu hình '{0}' thành công.", config.Name));
         if (config.SaveList)
         {
             return(RedirectToAction("Index"));
         }
         return(View("Edit", config));
     }
     return(View("Edit", config));
 }
コード例 #4
0
ファイル: SiteConfigController.cs プロジェクト: war-man/Cfood
        public ActionResult OnCreate(SiteConfigModels config)
        {
            if (ModelState.IsValid)
            {
                var result = SiteConfigService.Insert(config.CloneTo <SiteConfig>());

                if (result == "exists")
                {
                    ModelState.AddModelError("", string.Format("Tên cấu hình {0} đã tồn tại trên hệ thống.", config.Name));
                    return(View("Create", config));
                }
                SetFlashMessage(string.Format("Thêm cấu hình '{0}' thành công.", config.Name));
                if (config.SaveList)
                {
                    return(RedirectToAction("Index"));
                }
                ModelState.Clear();
                return(View("Create", config.ResetValue()));
            }
            return(View("Create", config));
        }
コード例 #5
0
ファイル: SiteConfigController.cs プロジェクト: war-man/Cfood
 public ActionResult Index()
 {
     return(View("Index", SiteConfigService.GetAll()));
 }
コード例 #6
0
 public static Dictionary<string, SiteMgrData> GetAllConfigs(string siteName, string language)
 {
     SiteConfigService siteConfigService = new SiteConfigService();
     return siteConfigService.GetSiteMgrDataBySite(siteName, language);
 }