示例#1
0
        private static async Task SeedCustomerAsync(KVDbContext context)
        {
            if (context.Customers.Any())
            {
                return;
            }

            var customers = new List <Customer>()
            {
                new Customer
                {
                    Name        = "Thai An",
                    Address     = "HCM City",
                    IsDelete    = false,
                    Phone       = "096 999 888",
                    POCode      = "123456",
                    Id          = new Guid("76af5bea-6af1-4a18-b38e-1396875518e5"),
                    CreatedDate = DateTime.UtcNow,
                    CreatedBy   = new Guid("76af5bea-6af1-4a18-b38e-1396875518e6"),
                    UpdatedBy   = Guid.Empty,
                    UpdatedDate = null,
                }
            };

            context.AddRange(customers);
            await context.SaveChangesAsync();
        }
示例#2
0
        private static async Task SeedUserAsync(KVDbContext context)
        {
            if (context.Users.Any())
            {
                return;
            }

            var users = new List <User>()
            {
                new User
                {
                    UserName    = "******",
                    Password    = "******",
                    Id          = new Guid("76af5bea-6af1-4a18-b38e-1396875518e5"),
                    FirstName   = "Administrator",
                    LastName    = "",
                    Email       = "*****@*****.**",
                    CreatedDate = DateTime.UtcNow,
                    CreatedBy   = new Guid("76af5bea-6af1-4a18-b38e-1396875518e6"),
                    DoB         = DateTime.UtcNow,
                    UpdatedBy   = Guid.Empty,
                    UpdatedDate = null,
                }
            };

            context.AddRange(users);
            await context.SaveChangesAsync();
        }