コード例 #1
0
ファイル: SettingsController.cs プロジェクト: jcapellman/DMTP
        public IActionResult Index(string actionMessage = null)
        {
            var model = new SettingsDashboardModel
            {
                ActionMessage = actionMessage,
                Setting       = _settingManager.GetSettings()
            };

            return(View(model));
        }
コード例 #2
0
ファイル: SettingsController.cs プロジェクト: jcapellman/DMTP
        public IActionResult AttemptUpdate(SettingsDashboardModel model)
        {
            if (model.GenerateNewRegistrationKey)
            {
                model.Setting.DeviceKeyPassword = Strings.GenerateRandomString();
            }

            var result = _settingManager.UpdateSettings(model.Setting);

            if (result)
            {
                CurrentSettings = model.Setting;
            }

            return(RedirectToAction("Index",
                                    new { actionMessage = result ? _localizer["SuccessfullyUpdated"] : _localizer["FailedUpdated"] }));
        }