public async Task <TEntity> AddAsync(TEntity entity) { var result = await _dbSet.AddAsync(entity); await _context.SaveChangesAsync(); return(result.Entity); }
public static async Task InitializeDbForTests(TorrentsContext context) { await context.Forums.AddRangeAsync(InitialEntities.Forums); await context.Torrents.AddRangeAsync(InitialEntities.Torrents); await context.Files.AddRangeAsync(InitialEntities.Files); await context.SaveChangesAsync(); }