public async Task <Either <ActionResult, ManageContentPageViewModel> > GetManageContentPageViewModel( Guid releaseId) { return(await _persistenceHelper .CheckEntityExists <Release>(releaseId) .OnSuccess(HydrateReleaseForReleaseViewModel) .OnSuccess(_userService.CheckCanViewRelease) .OnSuccessCombineWith(release => _contentService.GetUnattachedContentBlocks <DataBlock>(releaseId)) .OnSuccessCombineWith(releaseAndBlocks => _releaseFileService.ListAll( releaseId, Ancillary, FileType.Data)) .OnSuccess(async releaseBlocksAndFiles => { var(release, blocks, files) = releaseBlocksAndFiles; var methodologies = await _methodologyVersionRepository.GetLatestVersionByPublication(release.PublicationId); var releaseViewModel = _mapper.Map <ManageContentPageViewModel.ReleaseViewModel>(release); releaseViewModel.DownloadFiles = files.ToList(); releaseViewModel.Publication.Methodologies = _mapper.Map <List <TitleAndIdViewModel> >(methodologies); return new ManageContentPageViewModel { Release = releaseViewModel, AvailableDataBlocks = blocks }; })); }
public async Task <Either <ActionResult, ManageContentPageViewModel> > GetManageContentPageViewModel( Guid releaseId) { return(await _persistenceHelper .CheckEntityExists <Release>(releaseId, HydrateReleaseForReleaseViewModel) .OnSuccess(_userService.CheckCanViewRelease) .OnSuccess(release => _contentService.GetUnattachedContentBlocksAsync <DataBlock>(releaseId) .OnSuccess(blocks => _releaseFileService.ListAll( releaseId, Ancillary, FileType.Data) .OnSuccess(files => { var releaseViewModel = _mapper.Map <ManageContentPageViewModel.ReleaseViewModel>(release); releaseViewModel.DownloadFiles = files.ToList(); return new ManageContentPageViewModel { Release = releaseViewModel, AvailableDataBlocks = blocks }; })))); }
public async Task <ActionResult <IEnumerable <FileInfo> > > GetAncillaryFilesAsync(Guid releaseId) { return(await _releaseFileService .ListAll(releaseId, Ancillary) .HandleFailuresOrOk()); }