Exemplo n.º 1
0
        public async Task UpdateCategoryAsync(CategoryDTO categoryDTO)
        {
            var category = _mapper.Map <Category>(categoryDTO);
            await _categoryRepository.UpdateAsync(category);

            _cacheManager.Remove(CacheKeys.GetCategoryKey(categoryDTO.Id));
        }
Exemplo n.º 2
0
        public async Task RemoveCategoryAsync(int categoryId)
        {
            var category = await _categoryRepository.GetByIdAsync(categoryId);

            if (category == null)
            {
                throw new NotFoundException(nameof(Category), category);
            }

            await _categoryRepository.RemoveAsync(category);

            _cacheManager.Remove(CacheKeys.GetCategoryKey(categoryId));
        }