Example #1
0
        public static void Initialize(MyStoreContext context)
        {
            if (!context.Menus.Any())
            {
                context.Menus.AddRange(
                    new Menu
                {
                    Title = "Breakfast"
                },
                    new Menu
                {
                    Title = "Lunch"
                },
                    new Menu
                {
                    Title = "Dinner"
                }
                    );

                context.SaveChanges();
            }
        }
Example #2
0
        public static void Initialize(MyStoreContext context)
        {
            if (!context.Employees.Any())
            {
                context.Employees.AddRange(

                    new Employee
                {
                    Id                = 0001,
                    Name              = "Admin",
                    Position          = "Admin",
                    Wage              = 25m,
                    IsCurrentEmployee = true,
                    Password          = "******"
                },
                    new Employee
                {
                    Id                = 0002,
                    Name              = "Employee 1",
                    Position          = "Manager",
                    Wage              = 15m,
                    IsCurrentEmployee = true,
                    Password          = "******"
                },
                    new Employee
                {
                    Id                = 0003,
                    Name              = "Employee 2",
                    Position          = "Team Member",
                    Wage              = 10m,
                    IsCurrentEmployee = true,
                    Password          = "******"
                }
                    );

                context.SaveChanges();
            }
        }
Example #3
0
        public static void Initialize(MyStoreContext context)
        {
            if (!context.TimeSheets.Any())
            {
                context.TimeSheets.AddRange(
                    new TimeSheet
                {
                    Hours      = 10,
                    Rate       = 15.5f,
                    Date       = "2/07/19",
                    EmployeeId = 1
                },
                    new TimeSheet
                {
                    Hours      = 20,
                    Rate       = 10f,
                    Date       = "04/23/19",
                    EmployeeId = 2
                }
                    );

                context.SaveChanges();
            }
        }