public async Task <bool> CreateUpdateOrganizationsAsync(List <Organization> organizations) { using (var context = new DotNetDemoContext()) { context.Database.ExecuteSqlCommand("TRUNCATE TABLE [Organizations]"); ((DbSet <Organization>)context.Organizations).AddRange(organizations); await context.SaveChangesAsync(); return(true); } }
public async Task <bool> CreateUpdateLicensesAsync(List <License> licenses) { using (var context = new DotNetDemoContext()) { try { context.Database.ExecuteSqlCommand("TRUNCATE TABLE [Licenses]"); ((DbSet <License>)context.Licenses).AddRange(licenses); await context.SaveChangesAsync(); } catch (Exception ex) { throw; } return(true); } }