コード例 #1
0
 public GpsInfoesController(Hindsite2ProjectContext context)
 {
     _context = context;
 }
コード例 #2
0
 public ClientPasswordsController(Hindsite2ProjectContext context)
 {
     _context = context;
 }
コード例 #3
0
 public EmployeesController(Hindsite2ProjectContext context)
 {
     _context = context;
 }
コード例 #4
0
        public static void Initialize(Hindsite2ProjectContext context)
        {
            if (context.Client.Any())
            {
                return;
            }

            //Clients
            var clients = new Client[]
            {
                new Client
                {
                    CompanyName = "Jonah Energy",
                    Location    = "Jonah Energy LLC, 83 Luman Road Pinedale, WY 82941, Boulder, WY 82923"
                },
                new Client
                {
                    CompanyName = "Linn Energy",
                    Location    = "E Oklahoma Ave, Ulysses, KS 67880"
                }
            };

            foreach (Client c in clients)
            {
                context.Client.Add(c);
            }
            context.SaveChanges();

            // Client Password Table
            var clientPasswords = new ClientPassword[]
            {
                new ClientPassword
                {
                    ClientUserName  = "******",
                    ClientPasswords = "Password"
                }
            };

            foreach (ClientPassword p in clientPasswords)
            {
                context.ClientPassword.Add(p);
            }
            context.SaveChanges();

            // Employee's
            var employees = new Employee[]
            {
                new Employee
                {
                    FirstName = "David",
                    LastName  = "Jones"
                },
                new Employee
                {
                    FirstName = "Nolan",
                    LastName  = "Jones"
                }
            };

            foreach (Employee e in employees)
            {
                context.Employee.Add(e);
            }
            context.SaveChanges();

            // Employee Passwords Table
            var employeePasswords = new EmployeePassword[]
            {
                new EmployeePassword
                {
                    EmployeeUserName  = "******",
                    EmployeePasswords = "Password"
                }
            };

            foreach (EmployeePassword ep in employeePasswords)
            {
                context.EmployeePassword.Add(ep);
            }
            context.SaveChanges();

            // Gps Info table
            var gpsInfos = new GpsInfo[]
            {
                new GpsInfo
                {
                    GpsFile   = "file address",
                    Locations = "SHB 101",
                    Date      = DateTime.Parse("2019-07-10")
                }
            };

            foreach (GpsInfo g in gpsInfos)
            {
                context.GpsInfo.Add(g);
            }
            context.SaveChanges();
        }