Exemple #1
0
        public ActionResult General(GeneralConfigViewModel model)
        {
            if (ModelState.IsValid)
            {
                _generalConfig = WebConfigurationManager.OpenWebConfiguration("~").GetSection("GeneralConfig") as GeneralConfig;

                _generalConfig.WebTitle = model.WebTitle;
                _generalConfig.WebUrl = model.WebUrl;
                _generalConfig.WebLogo = model.WebLogo;
                _generalConfig.WebSlogan = model.WebSlogan ?? "";
                _generalConfig.Phone = model.Phone ?? "";
                _generalConfig.Email = model.Email ?? "";
                _generalConfig.Address = model.Address ?? "";
                _generalConfig.Icp = model.Icp ?? "";
                _generalConfig.FooterCode = model.FooterCode ?? "";
                _generalConfig.SeoTitle = model.SeoTitle ?? "";
                _generalConfig.SeoKeywords = model.SeoKeywords ?? "";
                _generalConfig.SeoDescription = model.SeoDescription ?? "";
                _generalConfig.Closed = model.Closed;
                _generalConfig.ClosedReason = model.ClosedReason ?? "";

                _generalConfig.CurrentConfiguration.Save();
                return RedirectToAction("General");
            }
            return View(model);
        }
Exemple #2
0
        public ActionResult General()
        {
            _generalConfig = WebConfigurationManager.OpenWebConfiguration("~").GetSection("GeneralConfig") as GeneralConfig;

            var model = new GeneralConfigViewModel
            {
                WebTitle = _generalConfig.WebTitle,
                WebUrl = _generalConfig.WebUrl,
                WebLogo = _generalConfig.WebLogo,
                WebSlogan = _generalConfig.WebSlogan,
                Phone = _generalConfig.Phone,
                Email = _generalConfig.Email,
                Address = _generalConfig.Address,
                Icp = _generalConfig.Icp,
                FooterCode = _generalConfig.FooterCode,
                SeoTitle = _generalConfig.SeoTitle,
                SeoKeywords = _generalConfig.SeoKeywords,
                SeoDescription = _generalConfig.SeoDescription,
                Closed = _generalConfig.Closed,
                ClosedReason = _generalConfig.ClosedReason
            };

            return View(model);
        }