public ResourceSyncStatistics SyncBundleDeletions(ResourceAssembly ra, List<string> existingBundleNames) { var context = new TinyTranslatorDbContext(); var task = new SyncResourcesTask( new ResourceAssemblyRepository(context), new ResourceBundleRepository(context), new ResourceRepository(context), new ResourceTranslationRepository(context) ); var assembly = task.SyncResourceAssembly(ra); task.DeleteNonExistingBundles(assembly, existingBundleNames); context.SaveChanges(); task.CalculateAssemblyStatusFromBundles(assembly); context.SaveChanges(); return task.Statistics; }
private ResourceSyncStatistics InnerSyncResourceAssembly(ResourceAssembly ra, ICollection<ResourceBundle> bundles, bool deleteBundles) { var context = new TinyTranslatorDbContext(); var task = new SyncResourcesTask( new ResourceAssemblyRepository(context), new ResourceBundleRepository(context), new ResourceRepository(context), new ResourceTranslationRepository(context) ); var assembly = task.SyncResourceAssembly(ra); if (deleteBundles) task.SyncAllBundlesWithDeletions(assembly, bundles); else task.SyncSomeBundles(assembly, bundles); context.SaveChanges(); task.CalculateAssemblyStatusFromBundles(assembly); context.SaveChanges(); return task.Statistics; }