Esempio n. 1
0
        /* Deletes the given gateway */
        public Gateway DeleteGateway(Gateway gateway)
        {
            using (IndoorPositioningContext db = new IndoorPositioningContext())
            {
                db.Gateways.Remove(gateway);
                db.SaveChanges();

                return(gateway);
            }
        }
        /* Adds new fingerprinting record */
        public Fingerprinting NewFingerprint(Fingerprinting fingerprinting)
        {
            using (IndoorPositioningContext db = new IndoorPositioningContext())
            {
                db.Fingerprintings.Add(fingerprinting);
                db.SaveChanges();

                return(fingerprinting);
            }
        }
Esempio n. 3
0
        /* Adds new gateway */
        public Gateway NewGateway(Gateway gateway)
        {
            using (IndoorPositioningContext db = new IndoorPositioningContext())
            {
                db.Gateways.Add(gateway);
                db.SaveChanges();

                return(gateway);
            }
        }
Esempio n. 4
0
        /* Deletes the given beacon */
        public Beacon DeleteBeacon(Beacon beacon)
        {
            using (IndoorPositioningContext db = new IndoorPositioningContext())
            {
                db.Beacons.Remove(beacon);
                db.SaveChanges();

                return(beacon);
            }
        }
Esempio n. 5
0
        /* Adds new beacon */
        public Beacon NewBeacon(Beacon beacon)
        {
            using (IndoorPositioningContext db = new IndoorPositioningContext())
            {
                db.Beacons.Add(beacon);
                db.SaveChanges();

                return(beacon);
            }
        }
Esempio n. 6
0
        /* Updates the given environment */
        public Environment UpdateEnvironment(Environment environment)
        {
            using (IndoorPositioningContext db = new IndoorPositioningContext())
            {
                db.Environments.Update(environment);
                db.SaveChanges();

                return(environment);
            }
        }
        public void SetStatus(int ID, Space space, string status)
        {
            Tracker tracker = GetTracker(ID);

            tracker.trainingLocation = space;
            tracker.Status           = status;
            db.Entry(tracker).State  = EntityState.Modified;
            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
            }
        }
Esempio n. 8
0
        public void PutOrientation(TrackerOrientation tO)
        {
            var trackerOrientations = db.TrackerOrientations.Where(x => x.Tracker.ID == tO.Tracker.ID);

            if (trackerOrientations.Count() == 0)
            {
                db.TrackerOrientations.Add(tO);
            }
            else
            {
                var trackerOrientation = trackerOrientations.First();
                trackerOrientation.Orientation     = tO.Orientation;
                trackerOrientation.TimeStamp       = tO.TimeStamp;
                db.Entry(trackerOrientation).State = EntityState.Modified;
            }
            try
            {
                db.SaveChanges();
            }
            catch (System.Data.Entity.Infrastructure.DbUpdateConcurrencyException)
            {
                throw;
            }
        }
 public void PostStorey(Storey storey)
 {
     db.Storeys.Add(storey);
     db.SaveChanges();
 }
 public void PostAddress(Address address)
 {
     db.Addresses.Add(address);
     db.SaveChanges();
 }
 public void PostBuilding(Building building)
 {
     db.Buildings.Add(building);
     db.SaveChanges();
 }
Esempio n. 12
0
 public void PostSpace(Space space)
 {
     db.Spaces.Add(space);
     db.SaveChanges();
 }