private async Task ValidateCategory(int id) { var Category = await EcomakRepository.GetCategoryAsync(id); if (Category == null) { throw new NotFoundItemException($"cannot found Category with id:{id}"); } }
public async Task <Category> GetCategoryAsync(int id, bool showProducts) { var CategoryEntity = await CategoriesRepository.GetCategoryAsync(id, showProducts); if (CategoryEntity == null) { throw new NotFoundItemException("Category not found"); } return(mapper.Map <Category>(CategoryEntity)); }
private async Task ValidateTrUpdate(int id, int CategoryId, Tr EditTr) { var Category = await EcomakRepository.GetCategoryAsync(CategoryId); if (Category == null) { throw new NotFoundItemException($"CanNot found Category with id {CategoryId}"); } var Tr = await EcomakRepository.GetTrAsync(id); if (Tr == null) { throw new NotFoundItemException($"CanNot found Category with id {id}"); } }