예제 #1
0
        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();
            }
        }
예제 #2
0
 public bool Commit()
 {
     return(_dbContext.SaveChanges() > 0);
 }
예제 #3
0
 public void SaveChanges()
 {
     _dbContext.SaveChanges();
 }