public async Task UpdateCategoryAsync(CategoryDTO categoryDTO) { var category = _mapper.Map <Category>(categoryDTO); await _categoryRepository.UpdateAsync(category); _cacheManager.Remove(CacheKeys.GetCategoryKey(categoryDTO.Id)); }
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)); }