Esempio n. 1
0
        public async Task <ActionResult <ChapterTextsApiResponse> > UpdateChapterTexts(Guid id, [FromForm] UpdateChapterTextsApiRequest request)
        {
            UpdateChapterTexts texts   = _mapper.Map <UpdateChapterTexts>(request);
            ChapterTexts       updated = await _chapterAdminService.UpdateChapterTexts(GetMemberId(), id, texts);

            return(_mapper.Map <ChapterTextsApiResponse>(updated));
        }
Esempio n. 2
0
 public async Task UpdateChapterTexts(ChapterTexts texts)
 {
     await Context
     .Update <ChapterTexts>()
     .Set(x => x.RegisterText, texts.RegisterText)
     .Set(x => x.WelcomeText, texts.WelcomeText)
     .Where(x => x.ChapterId).EqualTo(texts.ChapterId)
     .ExecuteAsync();
 }
Esempio n. 3
0
        public async Task <ChapterTexts> UpdateChapterTexts(Guid currentMemberId, Guid chapterId, UpdateChapterTexts texts)
        {
            await AssertMemberIsChapterAdmin(currentMemberId, chapterId);

            if (string.IsNullOrWhiteSpace(texts.RegisterText) ||
                string.IsNullOrWhiteSpace(texts.WelcomeText))
            {
                throw new OdkServiceException("Some required fields are missing");
            }

            ChapterTexts update = new ChapterTexts(chapterId, texts.RegisterText, texts.WelcomeText);

            await _chapterRepository.UpdateChapterTexts(update);

            _cacheService.RemoveVersionedItem <ChapterTexts>(chapterId);

            return(update);
        }