Example #1
0
 public ContactAdapter
 (
     UpriseContext databaseContext,
     ContactRepository contactRepository
 )
 {
     _databaseContext   = databaseContext ?? throw new ArgumentNullException(nameof(databaseContext));
     _contactRepository = contactRepository ?? throw new ArgumentNullException(nameof(contactRepository));
 }
 public CampaignAdapter
 (
     UpriseContext databaseContext,
     CampaignRepository campaignRepository,
     SendgridService sendgridService
 )
 {
     _databaseContext    = databaseContext ?? throw new ArgumentNullException(nameof(databaseContext));
     _campaignRepository = campaignRepository ?? throw new ArgumentNullException(nameof(campaignRepository));
     _sendGridService    = sendgridService ?? throw new ArgumentNullException(nameof(sendgridService));
 }
Example #3
0
 public SendgridService
 (
     UpriseApiConfiguration configuration,
     UpriseContext databaseContext,
     UsersService usersService
 )
 {
     _databaseContext = databaseContext ?? throw new ArgumentNullException(nameof(databaseContext));
     _usersService    = usersService ?? throw new ArgumentNullException(nameof(usersService));
     _apiKey          = configuration?.Sendgrid?.ApiKey ?? throw new ArgumentNullException("apiKey");
     _sendEmails      = configuration?.Sendgrid?.SendEmails ?? false;
 }
 public EntitiesController(ICurrentUserAccessor currentUserAccessor, UpriseContext upriseContext)
 {
     _currentUserAccessor = currentUserAccessor;
     _upriseContext       = upriseContext;
 }
Example #5
0
 public IdentityHelper(UpriseContext upriseContext, UsersService usersService)
 {
     _upriseContext = upriseContext;
     _usersService  = usersService;
 }
Example #6
0
 public DistributorsController(UpriseContext upriseContext)
 {
     _upriseContext = upriseContext;
 }
 public CampaignRepository(UpriseContext upriseContext)
 {
     _upriseContext = upriseContext ?? throw new ArgumentNullException(nameof(upriseContext));
 }
Example #8
0
        public static void InitializeDatabase(IServiceProvider serviceProvider)
        {
            using
            (
                var context = new UpriseContext
                              (
                    serviceProvider.GetRequiredService <DbContextOptions <UpriseContext> >())
            )
            {
                if (!context.Industries.Any())
                {
                    context.Industries.AddRange
                    (
                        new Industry {
                        Id = 1, Name = "Food"
                    },
                        new Industry {
                        Id = 2, Name = "Fashion"
                    },
                        new Industry {
                        Id = 3, Name = "Health care"
                    },
                        new Industry {
                        Id = 4, Name = "Insurance"
                    },
                        new Industry {
                        Id = 5, Name = "Travel"
                    }
                    );
                }

                if (!context.Tag.Any())
                {
                    context.Tag.AddRange
                    (
                        new Tag {
                        Id = 1, TagName = "Food"
                    },
                        new Tag {
                        Id = 2, TagName = "Fashion"
                    },
                        new Tag {
                        Id = 3, TagName = "Health care"
                    },
                        new Tag {
                        Id = 4, TagName = "Insurance"
                    },
                        new Tag {
                        Id = 5, TagName = "Travel"
                    }
                    );
                }

                if (!context.SocialMedias.Any())
                {
                    context.SocialMedias.AddRange
                    (
                        new SocialMedia {
                        Id = 1, SocialMediaName = "Facebook"
                    },
                        new SocialMedia {
                        Id = 2, SocialMediaName = "Google Plus"
                    },
                        new SocialMedia {
                        Id = 3, SocialMediaName = "Instagram"
                    },
                        new SocialMedia {
                        Id = 4, SocialMediaName = "LinkedIn"
                    },
                        new SocialMedia {
                        Id = 5, SocialMediaName = "Snapchat"
                    }
                    );
                }

                if (!context.DistributorStatus.Any())
                {
                    context.DistributorStatus.AddRange
                    (
                        new DistributorStatus {
                        Id = 1, StatusName = "Pending"
                    },
                        new DistributorStatus {
                        Id = 2, StatusName = "Active"
                    },
                        new DistributorStatus {
                        Id = 3, StatusName = "Inactive"
                    }
                    );
                }
                context.SaveChanges();
            }
        }