Example #1
0
        public static async Task Initialize(IServiceProvider serviceProvider, string password)
        {
            using (var context = new GiveFoodDbContext(
                       serviceProvider.GetRequiredService <DbContextOptions <GiveFoodDbContext> >()))
            {
                var adminID = await EnsureUser(serviceProvider, password, "*****@*****.**", "Administrator", "Аз съм системния администратор. Аз одобрявам или отхвърлям кандидатурите", UserType.Admin, UserStatus.Approved);
                await EnsureRole(serviceProvider, adminID, UserType.Admin.ToString());

                foreach (var user in Users)
                {
                    var userCreated = await EnsureUser(serviceProvider, user.Password, user.Email, user.Name, user.Description, user.Type, user.Status);

                    if (user.Status == UserStatus.Approved)
                    {
                        await EnsureRole(serviceProvider, userCreated, user.Type.ToString());
                    }
                }
            }
        }
 public DocumentRepository(GiveFoodDbContext dbContext)
 {
     this.dbContext = dbContext;
 }
 public NotificationRepository(GiveFoodDbContext dbContext)
 {
     this.dbContext = dbContext;
 }