Beispiel #1
0
        public LgaController(LgaContext context)
        {
            using (var db = context)
            {
                var lgas = db.Lgas
                           .ToList();

                Lgas = lgas;
            }
        }
Beispiel #2
0
        public void Setup()
        {
            var options = new DbContextOptionsBuilder <LgaContext>()
                          .UseInMemoryDatabase(databaseName: "Controller_Returns_Results")
                          .Options;

            using (var context = new LgaContext(options))
            {
                context.Lgas.Add(new LgaModel {
                    Place = "Albury (C)", State = "New South Wales", SEIFADisadvantage2011 = 979, SEIFADisadvantage2016 = 971
                });
                context.Lgas.Add(new LgaModel {
                    Place = "Alpine (S)", State = "Victoria", SEIFADisadvantage2011 = 987, SEIFADisadvantage2016 = 994
                });
                context.Lgas.Add(new LgaModel {
                    Place = "Aurukun (S)", State = "Queensland", SEIFADisadvantage2011 = 483, SEIFADisadvantage2016 = 504
                });
                context.SaveChanges();

                LgaController = new LgaController(context);
            }
        }