public IActionResult UpdateChapterResource(long chapterId, [FromBody] CreateChapterContract chapterData) { m_authorizationManager.AuthorizeResource(chapterId, PermissionFlag.EditProject); m_projectItemManager.UpdateChapterResource(chapterId, chapterData); return(Ok()); }
public IActionResult CreateChapterResource(long projectId, [FromBody] CreateChapterContract chapterData) { m_authorizationManager.AuthorizeBook(projectId, PermissionFlag.EditProject); var chapterId = m_projectItemManager.CreateChapterResource(projectId, chapterData); return(Ok(chapterId)); }
public CreateOrUpdateChapterWork(ResourceRepository resourceRepository, CreateChapterContract chapterData, long?projectId, long?resourceId, int userId) : base(resourceRepository) { m_resourceRepository = resourceRepository; m_chapterData = chapterData; m_projectId = projectId; m_resourceId = resourceId; m_userId = userId; }
public long CreateChapterResource(long projectId, CreateChapterContract chapterData) { var userId = m_authenticationManager.GetCurrentUserId(); var work = new CreateOrUpdateChapterWork(m_resourceRepository, chapterData, projectId, null, userId); work.Execute(); return(work.ResourceId); }
public void UpdateChapter(long chapterId, CreateChapterContract request) { try { m_client.Put <object>($"project/chapter/{chapterId}", request); } catch (HttpRequestException e) { if (m_logger.IsErrorEnabled()) { m_logger.LogError("{0} failed with {1}", m_client.GetCurrentMethod(), e); } throw; } }
public long CreateChapter(long projectId, CreateChapterContract request) { try { var result = m_client.Post <long>($"project/{projectId}/chapter", request); return(result); } catch (HttpRequestException e) { if (m_logger.IsErrorEnabled()) { m_logger.LogError("{0} failed with {1}", m_client.GetCurrentMethod(), e); } throw; } }
public void UpdateChapterResource(long chapterId, CreateChapterContract chapterData) { var userId = m_authenticationManager.GetCurrentUserId(); new CreateOrUpdateChapterWork(m_resourceRepository, chapterData, null, chapterId, userId).Execute(); }