Пример #1
0
        private IList <ChapterResource> GetChapterResourceVersions(IList <PageResource> pageResources)
        {
            var resourcePageIds         = pageResources.Select(x => x.Resource.Id);
            var chapterResourceVersions = m_resourceRepository.GetLatestChaptersByPages(resourcePageIds);

            return(chapterResourceVersions);
        }
Пример #2
0
        public void RemoveResource(long resourceId)
        {
            var resource      = m_resourceRepository.FindById <Resource>(resourceId);
            var pageResource  = m_resourceRepository.GetLatestResourceVersion <PageResource>(resourceId);
            var trackResource = m_resourceRepository.GetLatestResourceVersion <TrackResource>(resourceId);

            resource.IsRemoved = true;
            m_resourceRepository.Update(resource);

            if (pageResource != null)
            {
                var textResourceVersion = m_resourceRepository.GetLatestPageText(resourceId);
                TryRemoveResource(textResourceVersion);

                var imageResourceVersion = m_resourceRepository.GetLatestPageImage(resourceId);
                TryRemoveResource(imageResourceVersion);

                var chapterResourcesVersion = m_resourceRepository.GetLatestChaptersByPages(new[] { resourceId });
                TryRemoveResources(chapterResourcesVersion);
            }

            if (trackResource != null)
            {
                var audioResourceVersion = m_resourceRepository.GetAudioRecordingsByTrack(resourceId);
                TryRemoveResources(audioResourceVersion);
            }
        }