예제 #1
0
        public async Task UpdateAsync(Guid id, UpdateAuthorDto input)
        {
            var author = await _authorRepository.GetAsync(id);

            if (author.Name != input.Name)
            {
                await _authorManager.ChangeNameAsync(author, input.Name);
            }

            author.BirthDate = input.BirthDate;
            author.ShortBio  = input.ShortBio;

            await _authorRepository.UpdateAsync(author);
        }
        public async Task UpdateAsync(Guid id, UpdateAuthorDto input)
        {
            var author = await _authorRepository.GetAsync(id);

            if (author.Name != input.Name)
            {
                await _authorManager.ChangeNameAsync(author, input.Name);
            }

            author.BirthDate = input.BirthDate;
            author.ShortBio  = input.ShortBio;

            await _authorRepository.UpdateAsync(author);

            await _cacheService.RemoveAsync(AuthorCacheConsts.CachePrefix.Author);

            await _distributedEventBus.PublishAsync(new BookEventData
            {
                Key = AuthorCacheConsts.CachePrefix.Author
            });
        }