private async Task RemoveChartFileReleaseLinks(DeleteDataBlockPlan deletePlan)
        {
            var chartFileIds = deletePlan.DependentDataBlocks.SelectMany(
                block => block.InfographicFilesInfo.Select(f => f.Id));

            await _releaseFileService.Delete(deletePlan.ReleaseId, chartFileIds);
        }
        private async Task DeleteDependentDataBlocks(DeleteDataBlockPlan deletePlan)
        {
            var blockIdsToDelete = deletePlan
                                   .DependentDataBlocks
                                   .Select(block => block.Id);

            var dependentDataBlocks = _context
                                      .DataBlocks
                                      .Where(block => blockIdsToDelete.Contains(block.Id));

            _context.ContentBlocks.RemoveRange(dependentDataBlocks);
            await _context.SaveChangesAsync();
        }
示例#3
0
 public Task <Either <ActionResult, Unit> > DeleteDataBlocks(DeleteDataBlockPlan deletePlan)
 {
     return(InvalidateDataBlockCaches(deletePlan)
            .OnSuccess(() => DeleteDependentDataBlocks(deletePlan))
            .OnSuccessVoid(() => RemoveChartFileReleaseLinks(deletePlan)));
 }
 public async Task DeleteDataBlocks(DeleteDataBlockPlan deletePlan)
 {
     await DeleteDependentDataBlocks(deletePlan);
     await RemoveChartFileReleaseLinks(deletePlan);
 }