Beispiel #1
0
        public async Task UpdateChapterSubscription(Guid currentMemberId, Guid id, CreateChapterSubscription subscription)
        {
            ChapterSubscription existing = await _chapterRepository.GetChapterSubscription(id);

            if (existing == null)
            {
                throw new OdkNotFoundException();
            }

            await AssertMemberIsChapterAdmin(currentMemberId, existing.ChapterId);

            existing.Amount      = subscription.Amount;
            existing.Description = subscription.Description;
            existing.Months      = subscription.Months;
            existing.Name        = subscription.Name;
            existing.Title       = subscription.Title;
            existing.Type        = subscription.Type;

            await ValidateChapterSubscription(existing);

            await _chapterRepository.UpdateChapterSubscription(existing);
        }
Beispiel #2
0
        public async Task CreateChapterSubscription(Guid currentMemberId, Guid chapterId, CreateChapterSubscription subscription)
        {
            await AssertMemberIsChapterAdmin(currentMemberId, chapterId);

            ChapterSubscription create = new ChapterSubscription(Guid.Empty, chapterId, subscription.Type, subscription.Name,
                                                                 subscription.Title, subscription.Description, subscription.Amount, subscription.Months);

            await ValidateChapterSubscription(create);

            await _chapterRepository.CreateChapterSubscription(create);
        }