示例#1
0
        public async Task <IActionResult> Page(string id)
        {
            KirjaPage page = null;

            if (!string.IsNullOrEmpty(id))
            {
                page = await _pageDbAccess.GetPageById(id);
            }
            else
            {
                GoNorthProject project = await _projectDbAccess.GetDefaultProject();

                page = await _pageDbAccess.GetDefaultPageForProject(project.Id);

                if (page == null)
                {
                    page           = new KirjaPage();
                    page.IsDefault = true;
                    page.ProjectId = project.Id;
                    page.Name      = _localizer["DefaultPageName"];
                    page.Content   = _localizer["DefaultPageContent"];

                    _pageParserService.ParsePage(page);

                    page = await _pageDbAccess.CreatePage(page);
                }
            }
            return(Ok(page));
        }
示例#2
0
        /// <summary>
        /// Returns a wiki page by its id
        /// </summary>
        /// <param name="pageId">Page Id</param>
        /// <returns>Wiki page</returns>
        public async Task <KirjaPage> GetWikiPageById(string pageId)
        {
            if (string.IsNullOrEmpty(pageId))
            {
                return(null);
            }

            if (_cachedPages.ContainsKey(pageId))
            {
                return(_cachedPages[pageId]);
            }

            KirjaPage page = await _pageDbAccess.GetPageById(pageId);

            _cachedPages.Add(pageId, page);
            return(page);
        }
示例#3
0
        /// <summary>
        /// Syncs kirja marker label
        /// </summary>
        /// <param name="map">Map To sync</param>
        /// <returns>Task</returns>
        private async Task SyncKirjaMarkerLabels(KartaMap map)
        {
            if (map.KirjaPageMarker == null)
            {
                return;
            }

            foreach (KirjaPageMapMarker curMarker in map.KirjaPageMarker)
            {
                KirjaPage curPage = await _kirjaPageDbAccess.GetPageById(curMarker.PageId);

                if (curPage == null)
                {
                    continue;
                }

                curMarker.PageName = curPage.Name;
            }
        }