Esempio n. 1
0
        public async Task <CMSContentsOutput> GetAll()
        {
            var @CMSContents = await _CMSContentManager.GetAllAsync();

            /*if (@CMSContent == null)
             * {
             *  throw new UserFriendlyException("Could not found the event, maybe it's deleted.");
             * }*/

            var @CMSContentsOutput = new CMSContentsOutput();

            @CMSContentsOutput.items = new List <CMSContentDetailOutput>();

            foreach (CMSContent content in @CMSContents)
            {
                var @CMSContentDetailOutput = new CMSContentDetailOutput()
                {
                    id          = content.PageId,
                    pageName    = content.PageName,
                    pageContent = content.PageContent
                };

                @CMSContentsOutput.items.Add(@CMSContentDetailOutput);
            }
            ;

            return(@CMSContentsOutput);
        }
Esempio n. 2
0
        public async Task <CMSContentDetailOutput> InsertOrUpdateCMSContent(CreateCMSContentInput input)
        {
            var @CMSContent = await _CMSContentManager.InsertOrUpdateAsync(input.id, input.pageName, input.pageContent);

            var @CMSContentDetailOutput = new CMSContentDetailOutput()
            {
                id          = @CMSContent.PageId,
                pageName    = @CMSContent.PageName,
                pageContent = @CMSContent.PageContent
            };

            return(@CMSContentDetailOutput);
        }
Esempio n. 3
0
        public async Task <CMSContentDetailOutput> GetCMSContent(int pageId)
        {
            var @CMSContent = await _CMSContentManager.GetOneAsync(pageId);

            if (@CMSContent == null)
            {
                throw new UserFriendlyException("Could not found the page, maybe it's deleted!");
            }

            var @CMSContentDetailOutput = new CMSContentDetailOutput()
            {
                id          = @CMSContent.PageId,
                pageName    = @CMSContent.PageName,
                pageContent = @CMSContent.PageContent
            };

            return(@CMSContentDetailOutput);
        }