Пример #1
0
        public static void EnsurePopulated(IApplicationBuilder app)
        {
            CeltisITContext context = app.ApplicationServices.CreateScope().ServiceProvider.GetRequiredService <CeltisITContext>();

            if (context.Database.GetPendingMigrations().Any())
            {
                context.Database.Migrate();
            }
            if (!context.Users.Any())
            {
                context.Users.AddRange(new User
                {
                    FullName = "Emiola Abdulmueez",
                    Password = "******",
                    UserName = "******",
                    UserRole = "Admin"
                },
                                       new User
                {
                    FullName = "Olalemi Williams",
                    Password = "******",
                    UserName = "******",
                    UserRole = "Admin"
                }
                                       );
            }
            if (!context.Items.Any())
            {
                context.Items.AddRange(
                    new Item
                {
                    Title       = "Web Server",
                    Description = "IIS 7.0",
                    UnitType    = "Hours",
                    Rate        = 20
                },
                    new Item
                {
                    Title       = "Logo Design",
                    Description = "Designed a logo for app",
                    UnitType    = "PC",
                    Rate        = 100
                },
                    new Item
                {
                    Title       = "Application Development",
                    Description = "PHP application for project management",
                    UnitType    = "Hours",
                    Rate        = 20
                }
                    );
            }
            context.SaveChanges();
        }
Пример #2
0
 public LoginController(IConfiguration config, CeltisITContext context)
 {
     _config  = config;
     _context = context;
 }
Пример #3
0
 public ItemsController(CeltisITContext context)
 {
     _context = context;
 }
Пример #4
0
 public OrdersController(CeltisITContext context)
 {
     _context = context;
 }