public override void OnActionExecuting(ActionExecutingContext filterContext) { V308CMSEntities mEntities = new V308CMSEntities(); SiteRepository config = new SiteRepository(mEntities); dynamic ViewBag = filterContext.Controller.ViewBag; ViewBag.linkDomain = System.Configuration.ConfigurationManager.AppSettings["link_domain"]; ViewBag.productLink = System.Configuration.ConfigurationManager.AppSettings["product_link"]; try { ViewBag.domain = Theme.domain; ViewBag.ThemesPath = "/Content/themes/" + Theme.domain; ViewBag.MoneyShort = "vnđ"; ViewBag.SiteName = config.SiteConfig("site-name"); ViewBag.Hotline = config.SiteConfig("hotline"); ViewBag.CompanyFullname = config.SiteConfig("company-fullname"); ViewBag.FooterCompanyContact = config.SiteConfig("company-footer-contact"); ViewBag.CompanyHeaderAddress = config.SiteConfig("company-header-address"); ViewBag.FacebookPage = config.SiteConfig("affiliate-facebook-page"); } catch (Exception ex) { Console.Write(ex); } finally { mEntities.Dispose(); config.Dispose(); } }
public override void OnActionExecuting(ActionExecutingContext filterContext) { V308CMSEntities mEntities = new V308CMSEntities(); SiteRepository config = new SiteRepository(mEntities); VisisterRepository visister = new VisisterRepository(mEntities); visister.update(); dynamic viewBag = filterContext.Controller.ViewBag; try { viewBag.domain = Theme.domain; viewBag.ThemesPath = "/Content/themes/" + Theme.domain; viewBag.MoneyShort = "vnđ"; var configs = new[] { "site-name", "hotline", "company-fullname", "company-footer-contact", "company-header-address", "company-email", "company-position", "facebook-page", "gplus", "zalo", "youtube-channel", "product-text-view", "home-text-alias", "subscribe-news" }; var siteConfigs = config.LoadSiteConfig( configs ); if (siteConfigs.Any()) { viewBag.SiteName = config.ReadSiteConfig(siteConfigs, "site-name"); viewBag.Hotline = config.ReadSiteConfig(siteConfigs, "hotline"); viewBag.CompanyFullname = config.ReadSiteConfig(siteConfigs, "company-fullname"); viewBag.CompanyEmail = config.ReadSiteConfig(siteConfigs, "company-email"); viewBag.CompanyPosition = config.ReadSiteConfig(siteConfigs, "company-position"); viewBag.FooterCompanyContact = config.ReadSiteConfig(siteConfigs, "company-footer-contact"); viewBag.CompanyHeaderAddress = config.ReadSiteConfig(siteConfigs, "company-header-address"); viewBag.FacebookPage = config.ReadSiteConfig(siteConfigs, "facebook-page"); viewBag.GPlus = config.ReadSiteConfig(siteConfigs, "gplus"); viewBag.Zalo = config.ReadSiteConfig(siteConfigs, "zalo"); viewBag.Youtube = config.ReadSiteConfig(siteConfigs, "youtube-channel"); viewBag.ProductViewText = config.ReadSiteConfig(siteConfigs, "product-text-view"); viewBag.HomeAliasText = config.ReadSiteConfig(siteConfigs, "home-text-alias"); viewBag.SubscribeNews = config.ReadSiteConfig(siteConfigs, "subscribe-news"); } } catch (Exception ex) { Console.Write(ex); } finally { mEntities.Dispose(); config.Dispose(); } }