public async Task EnsureSeedDataAsync() { if (await _userManger.FindByEmailAsync("*****@*****.**") == null) { //add var newUser = new WorldUser { UserName = "******", Email = "*****@*****.**" }; await _userManger.CreateAsync(newUser, "P@ssword1234!"); } if (!_context.Trips.Any()) { var usTrip = new Trip { Name = "US Trip", Created = DateTime.UtcNow, UserName = "******", Stops = GetUsStops() }; _context.Trips.Add(usTrip); _context.Stops.AddRange(usTrip.Stops); var worldTrip = new Trip { Name = "World Trip", Created = DateTime.UtcNow, UserName = "******", Stops = GetWorldTrips() }; _context.Add(worldTrip); _context.AddRange(worldTrip.Stops); _context.SaveChanges(); } }
public bool SaveAll() { return(_context.SaveChanges() > 0); }