Exemplo n.º 1
0
        private static void SeedDb(FinancialManagerDbContext context)
        {
            //If default data is needed must be added here
            //For this example default transactions were added according to the dump .csv file provided by Zemoga

            //context.SaveChanges();
        }
Exemplo n.º 2
0
        public static async Task Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new FinancialManagerDbContext(serviceProvider.GetRequiredService <DbContextOptions <FinancialManagerDbContext> >()))
            {
                const string defaultPwd = "1234";

                //Assistant Role
                const string assistantRole     = "Assistant";
                const string assistantUsername = "******";
                var          assistantId       = await CreateUser(serviceProvider, defaultPwd, assistantUsername, assistantRole);

                //Manager Role
                const string managerRole     = "Manager";
                const string managerUsername = "******";
                var          managerId       = await CreateUser(serviceProvider, defaultPwd, managerUsername, managerRole);

                //Administrator Role
                const string administratorRole     = "Administrator";
                const string administratorUsername = "******";
                var          administratorId       = await CreateUser(serviceProvider, defaultPwd, administratorUsername, administratorRole);

                SeedDb(context);
            }
        }