Exemple #1
0
 public IndexModel(EffectiveWorkerContext context)
 {
     _context = context;
 }
Exemple #2
0
 public DetailsModel(EffectiveWorkerContext context)
 {
     _context = context;
 }
Exemple #3
0
        public static void Initialize(EffectiveWorkerContext context)
        {
            context.Database.EnsureCreated();

            if (context.Workers.Any())
            {
                return;
            }

            var workers = new Worker[]
            {
                new Worker {
                    FirstName = "Nino", LastName = "Olivetto", Patronymic = ""
                },
                new Worker {
                    FirstName = "Paulo", LastName = "Anand", Patronymic = ""
                },
                new Worker {
                    FirstName = "Nikolas", LastName = "Olivetto", Patronymic = ""
                },
                new Worker {
                    FirstName = "Albert", LastName = "Alonso", Patronymic = ""
                },
                new Worker {
                    FirstName = "Ann", LastName = "Alonso", Patronymic = ""
                }
            };

            foreach (Worker w in workers)
            {
                context.Workers.Add(w);
            }
            context.SaveChanges();

            var projects = new Project[]
            {
                new Project {
                    Name = "Skype", Premium = 5000
                },
                new Project {
                    Name = "Uno", Premium = 4000
                },
                new Project {
                    Name = "Rally", Premium = 7000
                },
                new Project {
                    Name = "Music box", Premium = 6000
                },
                new Project {
                    Name = "Painter", Premium = 3000
                }
            };

            foreach (Project p in projects)
            {
                context.Projects.Add(p);
            }
            context.SaveChanges();

            var enrollments = new Enrollment[]
            {
                new Enrollment {
                    WorkerID = 1, ProjectID = 1
                },
                new Enrollment {
                    WorkerID = 2, ProjectID = 2
                },
                new Enrollment {
                    WorkerID = 3, ProjectID = 4
                },
                new Enrollment {
                    WorkerID = 4, ProjectID = 3
                },
                new Enrollment {
                    WorkerID = 5, ProjectID = 1
                },
                new Enrollment {
                    WorkerID = 5, ProjectID = 2
                },
                new Enrollment {
                    WorkerID = 2, ProjectID = 3
                },
                new Enrollment {
                    WorkerID = 4, ProjectID = 1
                },
                new Enrollment {
                    WorkerID = 3, ProjectID = 5
                },
                new Enrollment {
                    WorkerID = 2, ProjectID = 5
                },
                new Enrollment {
                    WorkerID = 1, ProjectID = 4
                },
            };

            foreach (Enrollment e in enrollments)
            {
                context.Enrollment.Add(e);
            }
            context.SaveChanges();
        }
Exemple #4
0
 public DeleteModel(EffectiveWorkerContext context)
 {
     _context = context;
 }
Exemple #5
0
 public EditModel(EffectiveWorkerContext context)
 {
     _context = context;
 }
Exemple #6
0
 public CreateModel(EffectiveWorkerContext context)
 {
     _context = context;
 }