コード例 #1
0
 public void Update(User user)
 {
     using (var context = new LocationProviderContext())
     {
         context.User.AddOrUpdate(user);
         context.SaveChanges();
     }
 }
コード例 #2
0
 public void Remove(User user)
 {
     using (var context = new LocationProviderContext())
     {
         context.User.Remove(user);
         context.SaveChanges();
     }
 }
コード例 #3
0
 public void Remove(Device device)
 {
     using (var context = new LocationProviderContext())
     {
         context.Device.Remove(device);
         context.SaveChanges();
     }
 }
コード例 #4
0
 public void Remove(Geofence geofence)
 {
     using (var context = new LocationProviderContext())
     {
         context.Geofence.Remove(geofence);
         context.SaveChanges();
     }
 }
コード例 #5
0
 public void Update(Device device)
 {
     using (var context = new LocationProviderContext())
     {
         context.Device.AddOrUpdate(device);
         context.SaveChanges();
     }
 }
コード例 #6
0
 public void Add(Geofence geofence)
 {
     using (var context = new LocationProviderContext())
     {
         context.Geofence.AddOrUpdate(geofence);
         context.SaveChanges();
     }
 }
コード例 #7
0
 public void Remove(Location Location)
 {
     using (var context = new LocationProviderContext())
     {
         context.Location.Remove(Location);
         context.SaveChanges();
     }
 }
コード例 #8
0
 public void Update(Location Location)
 {
     using (var context = new LocationProviderContext())
     {
         context.Location.AddOrUpdate(Location);
         context.SaveChanges();
     }
 }
コード例 #9
0
 public void AddLocation(int id, Location location)
 {
     using (var context = new LocationProviderContext())
     {
         var device = context.Device.FirstOrDefault(a => a.DeviceId == id);
         context.Set <Device>().Attach(device);
         device.Locations.Add(location);
         context.SaveChanges();
     }
 }
コード例 #10
0
 public void AddNotExisting(string userId, User u)
 {
     using (var context = new LocationProviderContext())
     {
         var user = context.User.FirstOrDefault(a => a.UserId == userId);
         if (user == null)
         {
             context.User.AddOrUpdate(u);
             context.SaveChanges();
         }
     }
 }
コード例 #11
0
        public void Update(int id, float north, float south, float east, float west)
        {
            using (var context = new LocationProviderContext())
            {
                var device = context.Device.FirstOrDefault(a => a.DeviceId == id);

                device.Geofence.North = north;
                device.Geofence.South = south;
                device.Geofence.East  = east;
                device.Geofence.West  = west;

                context.Device.AddOrUpdate(device);

                context.SaveChanges();
            }
        }