@Override public void addProductToCategory(Category category, Product toAdd) { if (category.getId() == 0) { throw new IllegalArgumentException("The category id is not set"); } category.getProducts().add(toAdd); this.unitOfWork.beginTransaction(); this.categoryRepository.Update(category); this.unitOfWork.commit(); }
@Override public List<Mark> getMarkByCategory(Category category) { return this.markRepository.getMarkByCategoryId(category.getId()); }
@Override public List<Product> getProductByCategory(Category category) { return this.productRepository.getProductListByCategoryId(category.getId()); }