コード例 #1
0
        public async Task <Category> GetCategoryTrAsync(int id, bool showProducts)
        {
            var CategoryEntity = await CategoriesTrRepository.GetCategoryTrAsync(id, showProducts);

            if (CategoryEntity == null)
            {
                throw new NotFoundItemException("Category not found");
            }

            return(mapper.Map <Category>(CategoryEntity));
        }
コード例 #2
0
        private async Task ValidateCategory(int id)
        {
            var Category = await EcomakRepository.GetCategoryTrAsync(id);

            if (Category == null)
            {
                throw new NotFoundItemException($"cannot found Category with id:{id}");
            }
        }