示例#1
0
        public long CreateTextResource(long pageId, [FromBody] CreateTextRequestContract request)
        {
            m_authorizationManager.AuthorizeResource(pageId, PermissionFlag.EditProject);

            var resultResourceId = m_projectContentManager.CreateTextResourceOnPage(pageId, request);

            return(resultResourceId);
        }
示例#2
0
 public CreateEmptyTextResourceWork(ResourceRepository resourceRepository, long pageId, CreateTextRequestContract data,
                                    int userId, IFulltextStorage fulltextStorage) : base(resourceRepository)
 {
     m_resourceRepository = resourceRepository;
     m_pageId             = pageId;
     m_data            = data;
     m_userId          = userId;
     m_fulltextStorage = fulltextStorage;
 }
示例#3
0
        public long CreateTextResourceOnPage(long pageId, CreateTextRequestContract request)
        {
            var latestPage      = m_resourceRepository.InvokeUnitOfWork(x => x.GetLatestResourceVersion <PageResource>(pageId));
            var fulltextStorage = m_fulltextStorageProvider.GetFulltextStorage(latestPage.Resource.Project.ProjectType);

            var userId = m_authenticationManager.GetCurrentUserId();

            var resourceId = new CreateEmptyTextResourceWork(m_resourceRepository, pageId, request, userId, fulltextStorage).Execute();

            return(resourceId);
        }
示例#4
0
        public long CreateTextResource(long pageId, CreateTextRequestContract request)
        {
            try
            {
                var result = m_client.Post <long>($"project/page/{pageId}/text", request);
                return(result);
            }
            catch (HttpRequestException e)
            {
                if (m_logger.IsErrorEnabled())
                {
                    m_logger.LogError("{0} failed with {1}", m_client.GetCurrentMethod(), e);
                }

                throw;
            }
        }