Esempio n. 1
0
        public async Task <IActionResult> ManageTemplate(TemplateType templateType)
        {
            GoNorthUser currentUser = await _userManager.GetUserAsync(this.User);

            UserPreferences userPreferences = await _userPreferencesDbAccess.GetUserPreferences(currentUser.Id);

            string scriptLanguage = await GetScriptLanguage(_exportDefaultTemplateProvider.IsTemplateTypeLanguage(templateType));

            ManageTemplateViewModel viewModel = new ManageTemplateViewModel();

            if (userPreferences != null)
            {
                viewModel.CodeEditorTheme = userPreferences.CodeEditorTheme;
            }

            if (scriptLanguage != null)
            {
                viewModel.ScriptLanguage = scriptLanguage;
            }

            viewModel.TemplateTypeUrls.Add(BuildExportTemplateTypeUrl(TemplateType.ObjectNpc, "/Kortisto/Npc?id={0}"));
            viewModel.TemplateTypeUrls.Add(BuildExportTemplateTypeUrl(TemplateType.ObjectItem, "/Styr/Item?id={0}"));
            viewModel.TemplateTypeUrls.Add(BuildExportTemplateTypeUrl(TemplateType.ObjectSkill, "/Evne/Skill?id={0}"));

            viewModel.DisableAutoSaving = _config.DisableAutoSaving.HasValue ? _config.DisableAutoSaving.Value : false;

            return(View(viewModel));
        }
        public async Task <IActionResult> GetUserPreferences()
        {
            GoNorthUser currentUser = await _userManager.GetUserAsync(this.User);

            UserPreferences userPreferences = await _userPreferencesDbAccess.GetUserPreferences(currentUser.Id);

            return(Ok(userPreferences));
        }