コード例 #1
0
ファイル: ConfigController.cs プロジェクト: hiroakit/blog
        public ActionResult AccessAnalytics()
        {
            HNKBlogConfigManager cfgMgr = null;
            try
            {
                cfgMgr = new HNKBlogConfigManager(AppSettings.GetDbConnectionString());
            }
            catch (Exception e)
            {
                AzureLog.WriteToTable(e);
                return new HttpStatusCodeResult(500);
            }

            VMConfigAccessAnalytics model = new VMConfigAccessAnalytics();
            model.LoadUIElements();
            model.GoogleAnalytics = cfgMgr.GoogleAnalytics.Value;
            return View(model);
        }
コード例 #2
0
ファイル: ConfigController.cs プロジェクト: hiroakit/blog
        public ActionResult AccessAnalytics(VMConfigAccessAnalytics args)
        {
            if (!this.ModelState.IsValid)
            {
                return new HttpNotFoundResult();
            }

            BlogConfig config = new BlogConfig();
            config.Name = "google_analytics";
            config.Value = args.GoogleAnalytics;
            List<BlogConfig> configs = new List<BlogConfig> { };
            configs.Add(config);
            bool result = HNKBlogConfigFetcher.UpdateConfigs(AppSettings.GetDbConnectionString(), configs);
            if (!result)
            {
                return new HttpStatusCodeResult(500);
            }

            VMConfigBase model = new VMConfigBase();
            return View("Index", model);
        }