Пример #1
0
  @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();
  }
Пример #2
0
 @Override
 public List<Mark> getMarkByCategory(Category category) {
   return this.markRepository.getMarkByCategoryId(category.getId());
 }
Пример #3
0
 @Override
 public List<Product> getProductByCategory(Category category) {
   return this.productRepository.getProductListByCategoryId(category.getId());
 }