Exemplo n.º 1
0
        public ActionResult General(AdminGeneralSettingViewModel setting)
        {
            if (ModelState.IsValid)
            {
                using (var unitOfWork = UnitOfWorkManager.NewUnitOfWork())
                {
                    try
                    {
                        SettingsService.SetSetting("WebsiteName", setting.WebsiteName);
                        SettingsService.SetSetting("WebsiteUrl", setting.WebsiteUrl);
                        SettingsService.SetSetting("PageTitle", setting.PageTitle);
                        SettingsService.SetSetting("MetaDesc", setting.MetaDesc);


                        unitOfWork.Commit();
                        TempData[AppConstants.MessageViewBagName] = new GenericMessageViewModel
                        {
                            Message     = LocalizationService.GetResourceString("Cập nhật thành công!"),
                            MessageType = GenericMessages.success
                        };
                    }
                    catch (Exception ex)
                    {
                        unitOfWork.Rollback();
                        LoggingService.Error(ex);
                    }
                }
            }



            return(View("General", setting));
        }
Exemplo n.º 2
0
        public ActionResult General()
        {
            var model = new AdminGeneralSettingViewModel
            {
                WebsiteName = SettingsService.GetSetting("WebsiteName"),
                WebsiteUrl  = SettingsService.GetSetting("WebsiteUrl"),
                PageTitle   = SettingsService.GetSetting("PageTitle"),
                MetaDesc    = SettingsService.GetSetting("MetaDesc"),
            };

            return(View("General", model));
        }
Exemplo n.º 3
0
        public ActionResult General(AdminGeneralSettingViewModel setting)
        {
            if (ModelState.IsValid)
            {
                using (var unitOfWork = UnitOfWorkManager.NewUnitOfWork())
                {
                    try
                    {
                        SettingsService.SetSetting(AppConstants.STWebsiteName, setting.WebsiteName);
                        SettingsService.SetSetting(AppConstants.STWebsiteUrl, setting.WebsiteUrl);
                        SettingsService.SetSetting(AppConstants.STWebsiteImage, setting.WebSiteImage);
                        SettingsService.SetSetting(AppConstants.STPageTitle, setting.PageTitle);
                        SettingsService.SetSetting(AppConstants.STMetaDesc, setting.MetaDesc);
                        SettingsService.SetSetting(AppConstants.STKeyword, setting.Keyword);
                        SettingsService.SetSetting(AppConstants.STWebsiteFooter, setting.WebsiteFooter);


                        SettingsService.SetSetting(AppConstants.STFacebook, setting.Facebook);
                        SettingsService.SetSetting(AppConstants.STTwister, setting.Twister);
                        SettingsService.SetSetting(AppConstants.STInstagram, setting.Instagram);
                        SettingsService.SetSetting(AppConstants.STLinker, setting.Linker);
                        SettingsService.SetSetting(AppConstants.STSkype, setting.Skype);
                        SettingsService.SetSetting(AppConstants.STYouTube, setting.YouTube);
                        SettingsService.SetSetting(AppConstants.STGoogle, setting.Google);


                        unitOfWork.Commit();
                        TempData[AppConstants.MessageViewBagName] = new GenericMessageViewModel
                        {
                            Message     = LocalizationService.GetResourceString("Cập nhật thành công!"),
                            MessageType = GenericMessages.success
                        };
                    }
                    catch (Exception ex)
                    {
                        unitOfWork.Rollback();
                        LoggingService.Error(ex);
                    }
                }
            }



            return(View("General", setting));
        }
Exemplo n.º 4
0
        public ActionResult General()
        {
            var model = new AdminGeneralSettingViewModel
            {
                WebsiteName   = SettingsService.GetSetting(AppConstants.STWebsiteName),
                WebsiteUrl    = SettingsService.GetSetting(AppConstants.STWebsiteUrl),
                WebSiteImage  = SettingsService.GetSetting(AppConstants.STWebsiteImage),
                PageTitle     = SettingsService.GetSetting(AppConstants.STPageTitle),
                MetaDesc      = SettingsService.GetSetting(AppConstants.STMetaDesc),
                Keyword       = SettingsService.GetSetting(AppConstants.STKeyword),
                WebsiteFooter = SettingsService.GetSetting(AppConstants.STWebsiteFooter),


                Facebook  = SettingsService.GetSetting(AppConstants.STFacebook),
                Twister   = SettingsService.GetSetting(AppConstants.STTwister),
                Instagram = SettingsService.GetSetting(AppConstants.STInstagram),
                Linker    = SettingsService.GetSetting(AppConstants.STLinker),
                Skype     = SettingsService.GetSetting(AppConstants.STSkype),
                YouTube   = SettingsService.GetSetting(AppConstants.STYouTube),
                Google    = SettingsService.GetSetting(AppConstants.STGoogle),
            };

            return(View("General", model));
        }