Пример #1
0
 private void AddRoleIfNotExists(BankAppDataContext context, string role)
 {
     if (context.Roles.Any(r => r.Name == role))
     {
         return;
     }
     context.Roles.Add(new IdentityRole {
         Name = role, NormalizedName = role
     });
     context.SaveChanges();
 }
Пример #2
0
        private void SeedData(BankAppDataContext context)
        {
            if (!context.BatchStatus.Any(r => r.LastId > 0))
            {
                context.BatchStatus.Add(new BatchStatus {
                    LastId = 1
                });
            }

            if (context.MobileAppUsers.Count() == 0)
            {
                context.MobileAppUsers.Add(new MobileAppUsers
                {
                    Username   = "******",
                    Password   = "******",
                    CustomerId = 1
                });

                context.MobileAppUsers.Add(new MobileAppUsers
                {
                    Username   = "******",
                    Password   = "******",
                    CustomerId = 2
                });

                context.MobileAppUsers.Add(new MobileAppUsers
                {
                    Username   = "******",
                    Password   = "******",
                    CustomerId = 3
                });

                context.MobileAppUsers.Add(new MobileAppUsers
                {
                    Username   = "******",
                    Password   = "******",
                    CustomerId = 4
                });

                context.MobileAppUsers.Add(new MobileAppUsers
                {
                    Username   = "******",
                    Password   = "******",
                    CustomerId = 5
                });
            }

            context.SaveChanges();
        }