public async Task EnsureSeedData() { // Create the Db if it doesn't exist _context.Database.EnsureCreated(); // Seed the roles if (!_context.Roles.Any()) { await CreateRoles(); } // Seed the users if (!_context.Users.Any()) { await CreateUsers(); } // Seed the leaves if (!_context.Leaves.Any()) { CreateLeaves(); } // Actually save the changes to the db await _context.SaveChangesAsync(); }
public async Task <bool> SaveAllAsync() { return((await _context.SaveChangesAsync()) > 0); }