예제 #1
0
        public async Task UpdateEmail(Guid currentMemberId, Guid currentChapterId, EmailType type, UpdateEmail email)
        {
            await AssertMemberIsChapterSuperAdmin(currentMemberId, currentChapterId);

            Email existing = await _emailRepository.GetEmail(type);

            existing.HtmlContent = email.HtmlContent;
            existing.Subject     = email.Subject;

            ValidateEmail(existing);

            await _emailRepository.UpdateEmail(existing);
        }
예제 #2
0
        public async Task UpdateChapterEmail(Guid currentMemberId, Guid chapterId, EmailType type, UpdateEmail chapterEmail)
        {
            await AssertMemberIsChapterAdmin(currentMemberId, chapterId);

            ChapterEmail existing = await _emailRepository.GetChapterEmail(chapterId, type);

            if (existing == null)
            {
                existing = new ChapterEmail(Guid.Empty, chapterId, type, chapterEmail.Subject, chapterEmail.HtmlContent);
            }
            else
            {
                existing.HtmlContent = chapterEmail.HtmlContent;
                existing.Subject     = chapterEmail.Subject;
            }

            ValidateChapterEmail(existing);

            if (existing.Id != Guid.Empty)
            {
                await _emailRepository.UpdateChapterEmail(existing);
            }
            else
            {
                await _emailRepository.AddChapterEmail(existing);
            }
        }