public void Update(User user)
 {
     using (var context = new LocationProviderContext())
     {
         context.User.AddOrUpdate(user);
         context.SaveChanges();
     }
 }
 public void Remove(User user)
 {
     using (var context = new LocationProviderContext())
     {
         context.User.Remove(user);
         context.SaveChanges();
     }
 }
 public void Remove(Device device)
 {
     using (var context = new LocationProviderContext())
     {
         context.Device.Remove(device);
         context.SaveChanges();
     }
 }
Esempio n. 4
0
 public void Remove(Geofence geofence)
 {
     using (var context = new LocationProviderContext())
     {
         context.Geofence.Remove(geofence);
         context.SaveChanges();
     }
 }
 public void Update(Device device)
 {
     using (var context = new LocationProviderContext())
     {
         context.Device.AddOrUpdate(device);
         context.SaveChanges();
     }
 }
Esempio n. 6
0
 public void Add(Geofence geofence)
 {
     using (var context = new LocationProviderContext())
     {
         context.Geofence.AddOrUpdate(geofence);
         context.SaveChanges();
     }
 }
 public void Remove(Location Location)
 {
     using (var context = new LocationProviderContext())
     {
         context.Location.Remove(Location);
         context.SaveChanges();
     }
 }
 public void Update(Location Location)
 {
     using (var context = new LocationProviderContext())
     {
         context.Location.AddOrUpdate(Location);
         context.SaveChanges();
     }
 }
 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();
     }
 }
 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();
         }
     }
 }
Esempio n. 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();
            }
        }