public LoriotWebsocket(DataWebserviceContext _context) { this._context = _context; sc = new Controllers.API.SensorsController(_context); dc = new DataController(_context); slc = new SensorLogsController(_context); }
public Sensor GetMatchingSensor(Models.Data data, DataWebserviceContext context) { Sensor sense = context.Sensor.AsQueryable().FirstOrDefault(s => s.sensorEUID == data.sensorEUID); if (sense == null) { sense = new Sensor(); sense.sensorEUID = data.sensorEUID; int count = context.Sensor.AsQueryable().Count(); sense.sensorLog = new List <SensorLog>(); sense.servoSetting = "00000000"; sc.PostSensor(sense).Wait(); sense = context.Sensor.AsQueryable().FirstOrDefault(s => s.sensorEUID == data.sensorEUID); } return(sense); }
public static void Initialize(DataWebserviceContext context) { context.Database.EnsureCreated(); // Look for any Rooms. if (context.Room.Any()) { return; // DB has been seeded } var rooms = new Room[] { new Room { roomID = 1, roomName = "420" }, new Room { roomID = 2, roomName = "69" }, new Room { roomID = 3, roomName = "123" }, new Room { roomID = 4, roomName = "987" }, new Room { roomID = 5, roomName = "500" }, new Room { roomID = 6, roomName = "600" }, new Room { roomID = 7, roomName = "700" } }; foreach (Room r in rooms) { context.Room.Add(r); } //Cannot insert explicit value for identity column in table 'Room' when IDENTITY_INSERT is set to OFF context.SaveChanges(); }
public Datawarehousing(DataWebserviceContext dataWebserviceContext) { this._context = dataWebserviceContext; }