예제 #1
0
 public async Task Remove(Archive archive)
 {
     using (var EFR = new EFRepositoryContext())
     {
         EFR.Archives.Remove(archive);
         var filesToDelete = EFR.Files.Where(x => x.Archive.Name.Equals(archive.Name));
         EFR.Files.RemoveRange(filesToDelete);
         await EFR.SaveChangesAsync();
     }
 }
예제 #2
0
 public async Task Add(Archive archive)
 {
     using (var EFR = new EFRepositoryContext())
     {
         Task EFRAdd = Task.Run(() => EFR.Files.AddRange(archive.Files));
         EFRAdd.Wait();
         EFR.Archives.Add(archive);
         await EFR.SaveChangesAsync();
     }
 }