public static async Task InitializeAsync(EmployeesTasksDbContext context)
        {
            if (!context.EmployeeTasks.Any())
            {
                var employeeTasks = new List <EmployeeTask>
                {
                    new EmployeeTask {
                        Title = "Title 1", Description = "Description 1", Estimate = "2d", PriorityLevelId = 1, StateId = 1, EmployeeId = 1
                    },
                    new EmployeeTask {
                        Title = "Title 2", Description = "Description 2", Estimate = "5d", PriorityLevelId = 2, StateId = 2, EmployeeId = 1
                    },
                    new EmployeeTask {
                        Title = "Title 3", Description = "Description 3", Estimate = "6d", PriorityLevelId = 3, StateId = 3, EmployeeId = 1
                    },
                    new EmployeeTask {
                        Title = "Title 4", Description = "Description 4", Estimate = "7d", PriorityLevelId = 1, StateId = 4, EmployeeId = 2
                    },
                    new EmployeeTask {
                        Title = "Title 5", Description = "Description 5", Estimate = "8h", PriorityLevelId = 2, StateId = 1, EmployeeId = 2
                    },
                    new EmployeeTask {
                        Title = "Title 6", Description = "Description 6", Estimate = "11d", PriorityLevelId = 3, StateId = 2, EmployeeId = 2
                    }
                };

                await context.EmployeeTasks.AddRangeAsync(employeeTasks);

                await context.SaveChangesAsync();
            }
        }
Esempio n. 2
0
        public static async Task InitializeAsync(EmployeesTasksDbContext context)
        {
            if (!context.States.Any())
            {
                var states = new List <State>
                {
                    new State {
                        Name = "New"
                    },
                    new State {
                        Name = "Active"
                    },
                    new State {
                        Name = "Resolved"
                    },
                    new State {
                        Name = "Closed"
                    }
                };

                await context.States.AddRangeAsync(states);

                await context.SaveChangesAsync();
            }
        }
Esempio n. 3
0
        public static async Task InitializeAsync(EmployeesTasksDbContext context)
        {
            if (!context.Employees.Any())
            {
                var employees = new List <Employee>
                {
                    new Employee {
                        Name = "Employee 1"
                    },
                    new Employee {
                        Name = "Employee 2"
                    }
                };

                await context.Employees.AddRangeAsync(employees);

                await context.SaveChangesAsync();
            }
        }
        public static async Task InitializeAsync(EmployeesTasksDbContext context)
        {
            if (!context.PriorityLevels.Any())
            {
                var priorityLevels = new List <PriorityLevel>
                {
                    new PriorityLevel {
                        Name = "Critical", Order = 1
                    },
                    new PriorityLevel {
                        Name = "Medium", Order = 2
                    },
                    new PriorityLevel {
                        Name = "Low", Order = 3
                    }
                };

                await context.PriorityLevels.AddRangeAsync(priorityLevels);

                await context.SaveChangesAsync();
            }
        }