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)); }
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(); }
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); }