Esempio n. 1
0
        public IActionResult UpdateHumiity(int Humidity)
        {
            PlantContext p = new PlantContext("server=studmysql01.fhict.local;user id=dbi414674;password=Dse56VGQx3;database=dbi414674;");

            //   p.UpdateTemp(1, Humidity);

            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        public IActionResult UpdateTemp(int Temperatuur)
        {
            PlantContext p = new PlantContext("server=studmysql01.fhict.local;user id=dbi414674;password=Dse56VGQx3;database=dbi414674;");

            //p.UpdateTemp(1,Temperatuur);

            ViewData["Temp"] = p.GetCurrentValues(1);

            return(RedirectToAction("Index"));
        }
Esempio n. 3
0
        public void CanInsertPlantIntoDatabase()
        {
            using (var context = new PlantContext("Data Source = (localdb)\\MSSQLLocalDB; Initial Catalog = PlantTestData", false))
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();
                var plant = new Plant();
                context.Plants.Add(plant);
                context.SaveChanges();

                Assert.AreNotEqual(0, plant.Id);
            }
        }
Esempio n. 4
0
 public TemperatureController(PlantContext ctx)
 {
     _ctx = ctx;
 }
Esempio n. 5
0
 public AlarmtypeController(PlantContext ctx)
 {
     _ctx = ctx;
 }
 public Plants1Controller(PlantContext context)
 {
     _context = context;
 }
 public HomeController(PlantContext context)
 {
     _context = context;
 }
Esempio n. 8
0
 public HomeController(PlantContext context, INativeService nativeService)
 {
     _context      = context;
     _nativeServie = nativeService;
 }
Esempio n. 9
0
 public WatersController(PlantContext context)
 {
     _context = context;
 }
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new PlantContext(
                       serviceProvider.GetRequiredService <
                           DbContextOptions <PlantContext> >()))
            {
                // Looking for any plants.
                if (context.Plants.Any())
                {
                    return;   // DB has been seeded
                }

                // default data to seed the database with
                context.Plants.AddRange(
                    new Plant
                {
                    Name  = "Dragon Tree",
                    Water = new List <Water>
                    {
                        new Water()
                        {
                            Date     = DateTime.Now,
                            Duration = 6,
                        }
                    }
                },
                    new Plant
                {
                    Name  = "Raye Banana",
                    Water = new List <Water>
                    {
                        new Water()
                        {
                            Date     = DateTime.Now,
                            Duration = 4,
                        }
                    }
                },
                    new Plant
                {
                    Name  = "Cacti #1",
                    Water = new List <Water>
                    {
                        new Water()
                        {
                            Date     = DateTime.Now,
                            Duration = 3,
                        }
                    }
                },
                    new Plant
                {
                    Name  = "Cacti #2",
                    Water = new List <Water>
                    {
                        new Water()
                        {
                            Date     = DateTime.Now,
                            Duration = 5,
                        }
                    }
                },
                    new Plant
                {
                    Name  = "Pothos",
                    Water = new List <Water>
                    {
                        new Water()
                        {
                            Date     = DateTime.Now,
                            Duration = 10,
                        }
                    }
                },
                    new Plant
                {
                    Name  = "Jade",
                    Water = new List <Water>
                    {
                        new Water()
                        {
                            Date     = DateTime.Now,
                            Duration = 10,
                        }
                    }
                }
                    );

                context.SaveChanges();
            }
        }
Esempio n. 11
0
 public NativeService(PlantContext context)
 {
     _context = context;
 }
Esempio n. 12
0
 public ConfigController(PlantContext ctx)
 {
     _ctx = ctx;
 }
Esempio n. 13
0
 public InvasiveService(PlantContext context)
 {
     _context = context;
 }