public static void Seed(MSMContext context) { if (!context.GeolocationHistory.Any()) { var user = context.Users.FirstOrDefault(x => x.UserName == "123@123"); var profile = context.Profiles.FirstOrDefault(x => x.Id == user.ProfileId); var idx = 0; foreach (var geolocation in Geolocations) { context.GeolocationHistory.Add(new GeolocationHistory { Profile = profile, Latitude = geolocation.Latitude, Longitude = geolocation.Longitude, Time = DateTime.Now.AddMinutes(-idx), }); } context.SaveChanges(); } }
public bool Commit() { return(_dbContext.SaveChanges() > 0); }
public void SaveChanges() { _dbContext.SaveChanges(); }