Esempio n. 1
0
        public static void SeedDB(IdentiteitsContext context, string adminID)
        {
            if (context.Aanvragen.Any())
            {
                return;   // DB has been seeded
            }

            context.Aanvragen.AddRange(
                new Aanvraag
            {
                WerknemerNaam = " testpersoon",

                Soort   = SOORT.ADV,
                OwnerID = adminID
            }

                );
            context.SaveChanges();
        }
Esempio n. 2
0
        public static async Task Initialize(IServiceProvider serviceProvider, string testUserPw)
        {
            using (var context = new IdentiteitsContext(
                       serviceProvider.GetRequiredService <DbContextOptions <IdentiteitsContext> >()))
            {
                // For sample purposes seed both with the same password.
                // Password is set with the following:
                // dotnet user-secrets set SeedUserPW <pw>
                // The admin user can do anything

                var adminID = await EnsureUser(serviceProvider, testUserPw, "*****@*****.**");
                await EnsureRole(serviceProvider, adminID, Constants.AanvraagAdministratorsRole);

                // allowed user can create and edit aanvragen that they create
                var managerID = await EnsureUser(serviceProvider, testUserPw, "*****@*****.**");
                await EnsureRole(serviceProvider, managerID, Constants.AanvraagManagersRole);

                var HRID = await EnsureUser(serviceProvider, testUserPw, "*****@*****.**");
                await EnsureRole(serviceProvider, HRID, Constants.AanvraagHRsRole);

                SeedDB(context, adminID);
            }
        }
Esempio n. 3
0
 public IndexModel(Verlofsite.Data.IdentiteitsContext context)
 {
     _context = context;
 }
Esempio n. 4
0
 public DeleteModel(Verlofsite.Data.IdentiteitsContext context)
 {
     _context = context;
 }