Ejemplo n.º 1
0
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;

            using (var client = new OptiAirDbContext())
            {
                //client.Database.EnsureDeleted();

                client.Database.EnsureCreated();
            }
        }
Ejemplo n.º 2
0
        public MeasurementsController(OptiAirDbContext context)
        {
            _Context = context;

            //if (_Context.Measurements.Count() == 0)
            //{
            //    var measurement = new Measurement()
            //    {
            //        PM1 = 3,
            //        PM10 = 5,
            //        PM25 = 4,
            //        Pressure = 1028.00,
            //        Humidity = 90,
            //        Temperature = 22,
            //        MAC = "00:0A:E6:3E:FD:E1"
            //    };

            //    _Context.Measurements.Add(measurement);

            //    _Context.Measurements.Add(new Measurement()
            //    {
            //        PM1 = 3,
            //        PM10 = 6,
            //        PM25 = 5,
            //        Pressure = 1027.00,
            //        Humidity = 89,
            //        Temperature = 22,
            //        MAC = "00:0A:E6:3E:FD:E0"
            //    });

            //    _Context.Measurements.Add(new Measurement()
            //    {
            //        PM1 = 9,
            //        PM10 = 18,
            //        PM25 = 13,
            //        Pressure = 1028.00,
            //        Humidity = 90,
            //        Temperature = 22,
            //        MAC = "00:0A:E6:3E:FD:E1"
            //    });


            //    _Context.Measurements.Add(new Measurement()
            //    {
            //        PM1 = 2,
            //        PM10 = 3,
            //        PM25 = 4,
            //        Pressure = 1029.00,
            //        Humidity = 88,
            //        Temperature = 20,
            //        MAC = "00:0A:E6:3E:FD:E2"
            //    });

            //    _Context.Measurements.Add(new Measurement()
            //    {
            //        PM1 = 5,
            //        PM10 = 4,
            //        PM25 = 3,
            //        Pressure = 1030.00,
            //        Humidity = 92,
            //        Temperature = 18,
            //        MAC = "00:0A:E6:3E:FD:E3"
            //    });

            //    _Context.Measurements.Add(new Measurement()
            //    {
            //        PM1 = 3,
            //        PM10 = 4,
            //        PM25 = 2.5,
            //        Pressure = 1026.00,
            //        Humidity = 90,
            //        Temperature = 17,
            //        MAC = "00:0A:E6:3E:FD:E4"
            //    });

            //    _Context.Measurements.Add(new Measurement()
            //    {
            //        PM1 = 6,
            //        PM10 = 4,
            //        PM25 = 3,
            //        Pressure = 1028.00,
            //        Humidity = 84,
            //        Temperature = 17,
            //        MAC = "d4:25:8b:e9:22:fd"
            //    });

            //    _Context.SaveChanges();
            //}
        }
        public DevicesController(OptiAirDbContext context)
        {
            _Context = context;

            //if (_Context.Devices.Count() == 0)
            //{
            //    var device = new Device()
            //    {
            //        Longitude = 18.539444,
            //        Latitude = 54.519167,
            //        Name = "Initial",
            //        IsVerified = true,
            //        MAC = "00:0A:E6:3E:FD:E1"
            //    };



            //    _Context.Devices.Add(device);

            //    _Context.Devices.Add(new Device()
            //    {
            //        Longitude = 18.538709,
            //        Latitude = 54.521048,
            //        Name = "Initial1",
            //        IsVerified = true,
            //        MAC = "00:0A:E6:3E:FD:E0"
            //    });

            //    _Context.Devices.Add(new Device()
            //    {
            //        Longitude = 18.5419,
            //        Latitude = 54.517392,
            //        Name = "Initial2",
            //        IsVerified = true,
            //        MAC = "00:0A:E6:3E:FD:E2"
            //    });

            //    _Context.Devices.Add(new Device()
            //    {
            //        Longitude = 18.534997,
            //        Latitude = 54.517562,
            //        Name = "Initial3",
            //        IsVerified = true,
            //        MAC = "00:0A:E6:3E:FD:E3"
            //    });

            //    _Context.Devices.Add(new Device()
            //    {
            //        Longitude = 18.530847,
            //        Latitude = 54.521819,
            //        Name = "Initial4",
            //        IsVerified = true,
            //        MAC = "00:0A:E6:3E:FD:E4"
            //    });

            //    _Context.Devices.Add(new Device()
            //    {
            //        Longitude = 18.52824,
            //        Latitude = 54.518502,
            //        Name = "Initial4",
            //        IsVerified = true,
            //        MAC = "00:0A:E6:3E:FD:E5"
            //    });

            //    _Context.Devices.Add(new Device()
            //    {
            //        Longitude = 18.52224,
            //        Latitude = 54.512502,
            //        Name = "Morski",
            //        IsVerified = true,
            //        MAC = "d4:25:8b:e9:22:fd"
            //    });

            //    _Context.SaveChanges();
            //}
        }
Ejemplo n.º 4
0
 public TokenController(IConfiguration config, OptiAirDbContext context)
 {
     _config  = config;
     _context = context;
 }