Example #1
0
        public async Task UpdateChapterEmailProvider(Guid currentMemberId, Guid chapterEmailProviderId,
                                                     UpdateChapterEmailProvider provider)
        {
            ChapterEmailProvider update = await GetChapterEmailProvider(currentMemberId, chapterEmailProviderId);

            update.BatchSize        = provider.BatchSize;
            update.DailyLimit       = provider.DailyLimit;
            update.FromEmailAddress = provider.FromEmailAddress;
            update.FromName         = provider.FromName;
            update.SmtpLogin        = provider.SmtpLogin;
            update.SmtpPassword     = provider.SmtpPassword;
            update.SmtpPort         = provider.SmtpPort;
            update.SmtpServer       = provider.SmtpServer;

            ValidateChapterEmailProvider(update);

            await _chapterRepository.UpdateChapterEmailProvider(update);
        }
Example #2
0
        public async Task AddChapterEmailProvider(Guid currentMemberId, Guid chapterId, UpdateChapterEmailProvider provider)
        {
            await AssertMemberIsChapterAdmin(currentMemberId, chapterId);

            ChapterEmailProvider create = new ChapterEmailProvider(Guid.Empty, chapterId, provider.SmtpServer, provider.SmtpPort,
                                                                   provider.SmtpLogin, provider.SmtpPassword, provider.FromEmailAddress, provider.FromName,
                                                                   provider.BatchSize, provider.DailyLimit, 0);

            IReadOnlyCollection <ChapterEmailProvider> existing = await _chapterRepository.GetChapterEmailProviders(chapterId);

            create.Order = existing.Count + 1;

            ValidateChapterEmailProvider(create);

            await _chapterRepository.AddChapterEmailProvider(create);
        }