public async Task CreateTestArtifactCategoryRelationsip() { await InitDb(); var artifact = new Artifact { Path = "testRelationshipPath", Title = "testRelationshipArtifact", FileName = "testrel.pdf", FileType = "pdf", DateAdded = DateTime.Now, Active = true }; var category = new Category { Name = "TestRelationship Category", Active = true }; var artifactCategory = new Artifact_CategoryRepository(_db); await artifactCategory.AddRelationship(artifact, category); }
private async void Item_OnDrop(object sender, DragEventArgs e) { var selectedItems = ArtifactsGridView.SelectedItems; var destinationItem = (IDisplayItem)((StackPanel)sender).DataContext; if (destinationItem.GetType() != typeof(DisplayCategory)) { return; } var destinationCategory = ((DisplayCategory)destinationItem).GetCategory(); var artifactCategoryRepo = new Artifact_CategoryRepository(); foreach (IDisplayItem item in selectedItems) { if (item.GetType() != typeof(DisplayArtifact)) { return; } var artifact = ((DisplayArtifact)item).GetArtifact(); await artifactCategoryRepo.AddRelationship(artifact, destinationCategory); } await UpdateUi(); }