public long CreateTextResource(long pageId, [FromBody] CreateTextRequestContract request) { m_authorizationManager.AuthorizeResource(pageId, PermissionFlag.EditProject); var resultResourceId = m_projectContentManager.CreateTextResourceOnPage(pageId, request); return(resultResourceId); }
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; }
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); }
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; } }