Пример #1
0
        public IActionResult Setup(UserProfileModel profile)
        {
            profile.ID = Guid.Parse(_userManager.GetUserId(User));

            UserProfileHelper.AddOrUpdate(_database, profile, out var newProfile);

            if (newProfile)
            {
                _logger.Info($"New Profile Created: {profile.ID}, {profile.Name}");
            }

            return(RedirectToAction("Index"));
        }
Пример #2
0
        // InitializeConfiguration Method
        private void InitializeConfiguration()
        {
            if (ConfigurationUtil.ConfigurationJsonModel == null || ConfigurationUtil.ConfigurationJsonModel.BaseDirectoryPath == null || ConfigurationUtil.ConfigurationJsonModel.BaseDirectoryPath == String.Empty)
            {
                LoggingUtil.Warning("ConfigurationJsonModel was null, BASE_DIRECTORY_PATH was null or BASE_DIRECTORY_PATH was empty.");

                using (var folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog())
                {
                    folderBrowserDialog.Description = ApplicationManager.Localization.GetString("FOLDER_BROWSER_DIALOG_DESC");
                    System.Windows.Forms.DialogResult dialogResult = folderBrowserDialog.ShowDialog();

                    string directoryPath = null;

                    if (dialogResult == System.Windows.Forms.DialogResult.OK)
                    {
                        directoryPath = folderBrowserDialog.SelectedPath;
                    }
                    else
                    {
                        Environment.Exit(0);
                    }

                    MessageBoxResult messageBoxResult = MessageBox.Show(directoryPath + "\n\n" + ApplicationManager.Localization.GetString("FOLDER_BROWSER_RESULT_BODY"),
                                                                        ApplicationManager.Localization.GetString("FOLDER_BROWSER_RESULT_HEADER"), MessageBoxButton.YesNoCancel, MessageBoxImage.None,
                                                                        MessageBoxResult.None, MessageBoxOptions.DefaultDesktopOnly);

                    if (messageBoxResult == MessageBoxResult.No)
                    {
                        InitializeConfiguration();
                    }
                    else if (messageBoxResult == MessageBoxResult.Cancel)
                    {
                        Environment.Exit(0);
                    }
                    else
                    {
                        LoggingUtil.Info("The BASE_DIRECTORY_PATH has now a valid value.");
                        ConfigurationUtil.ConfigurationJsonModel.BaseDirectoryPath = directoryPath;
                        ConfigurationUtil.Save();
                    }
                }
            }
        }