Esempio n. 1
0
 private void GetDatasFromExportModel(ExportModel exportModel)
 {
     _dbImportService.ImportIdeas(exportModel.Ideas);
     _dbImportService.ImportComments(exportModel.Comments);
     _dbImportService.ImportRelationTypes(exportModel.RelationTypes);
     _dbImportService.ImportTags(exportModel.Tags);
     _dbImportService.ImportRelations(exportModel.Relations);
     _dbImportService.ImportParticles(exportModel.Particles);
     _dbImportService.ImportParticleInplaces(exportModel.ParticleInplaces);
     _dbImportService.ImportGuidableTags(exportModel.GuidableTagDtos);
     _dbImportService.ImportReferences(exportModel.References);
     _dbImportService.ImportSettings(exportModel.Settings);
     _dbImportService.ImportHeaders(exportModel.Headers);
 }
Esempio n. 2
0
 private ExportModel CreateExportModel(IEnumerable<Material> materials)
 {
     var exportModel = new ExportModel();
     exportModel.FileEntries = materials.Select(material => new FileEntry()
     {
         Path = GetRelativePathForMaterial(material),
         Author = material.Author,
         Source = material.Source,
         IsFolder = material.IsFolder,
         Id = material.Id
     }).ToArray();
     exportModel.Ideas = _map.Map<IdeaDto[]>(_dbInteropService.GetBlocks().OfType<Idea>());
     exportModel.Relations = _map.Map<RelationDto[]>(_dbInteropService.GetBlocks().OfType<Relation>());
     exportModel.RelationTypes = _dbInteropService.GetRelationTypes().ToArray();
     exportModel.Particles = _map.Map<ParticleDto[]>(_dbInteropService.GetParticles());
     exportModel.ParticleInplaces = _dbInteropService.GetParticlesInplaces().ToArray();
     exportModel.Tags = _map.Map<TagDto[]>(_dbInteropService.GetTags());
     exportModel.References = _map.Map<ReferenceDto[]>(_dbInteropService.GetReferences());
     exportModel.Comments = _map.Map<CommentDto[]>(_dbInteropService.GetBlocks().OfType<Comment>());
     exportModel.Settings = _map.Map<SettingDto[]>(_dbInteropService.GetSettings());
     exportModel.Headers = _map.Map<HeaderDto[]>(_dbInteropService.GetHeaders());
     var gts = _dbInteropService.GetTags().Where(t => t.Subjects.Any());
     var gt = gts.SelectMany(t => t.Subjects,
         (tag, guidable) => new GuidableTagDto() {GuidableId = guidable.Id, TagId = tag.Id}).ToArray();
     exportModel.GuidableTagDtos = gt;
     return exportModel;
 }