Ejemplo n.º 1
0
        public async Task SeedAsync(CampfireStoriesDbContext db, IServiceProvider service)
        {
            if (db == null)
            {
                throw new ArgumentNullException(nameof(db));
            }

            if (service == null)
            {
                throw new ArgumentNullException(nameof(service));
            }

            var seeders = new List <ISeeder>
            {
                new RolesSeeder(),
                new DataSeeder(),
            };

            foreach (var seeder in seeders)
            {
                await seeder.SeedAsync(db, service);

                await db.SaveChangesAsync();
            }
        }
Ejemplo n.º 2
0
        public async Task SeedAsync(CampfireStoriesDbContext db, IServiceProvider service)
        {
            var roleManager = service.GetRequiredService <RoleManager <Role> >();

            await SeedRoleAsync(roleManager, AdministratorRoleName);
            await SeedRoleAsync(roleManager, RegularUserRoleName);
            await SeedRoleAsync(roleManager, BannedUserRoleName);
        }
Ejemplo n.º 3
0
 public CommentsService(
     CampfireStoriesDbContext dbContext,
     IUsersService userService,
     ISubCommentsService subCommentsService)
 {
     this.dbContext          = dbContext;
     this.userService        = userService;
     this.subCommentsService = subCommentsService;
 }
Ejemplo n.º 4
0
        public async Task SeedAsync(CampfireStoriesDbContext db, IServiceProvider service)
        {
            var userManager = service.GetRequiredService <UserManager <User> >();

            var users = await userManager.Users.AnyAsync();

            if (!users)
            {
                await CreateAdmin(userManager, AdminUsername, AdminEmail, AdminGender);
            }
        }
Ejemplo n.º 5
0
 public StoriesService(
     CampfireStoriesDbContext dbContext,
     IUsersService userService,
     IStoryCategoriesService storyCategoriesService,
     ICommentsService commentService)
 {
     this.dbContext              = dbContext;
     this.userService            = userService;
     this.storyCategoriesService = storyCategoriesService;
     this.commentService         = commentService;
 }
Ejemplo n.º 6
0
 public IdentityService(UserManager <User> userManager, CampfireStoriesDbContext dbContext)
 {
     this.userManager = userManager;
     this.dbContext   = dbContext;
 }
 public StoryCategoriesService(CampfireStoriesDbContext dbContext)
 {
     this.dbContext = dbContext;
 }
Ejemplo n.º 8
0
 public UserReportsService(CampfireStoriesDbContext dbContext, IUsersService usersService)
 {
     this.dbContext    = dbContext;
     this.usersService = usersService;
 }
Ejemplo n.º 9
0
 public RatingsService(CampfireStoriesDbContext dbContext)
 {
     this.dbContext = dbContext;
 }
Ejemplo n.º 10
0
 public CategoriesService(CampfireStoriesDbContext dbContext, IUsersService userService)
 {
     this.dbContext   = dbContext;
     this.userService = userService;
 }