Exemplo n.º 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();
  }
Exemplo n.º 2
0
 @Override
 public List<Mark> getMarkByCategory(Category category) {
   return this.markRepository.getMarkByCategoryId(category.getId());
 }
Exemplo n.º 3
0
 @Override
 public List<Product> getProductByCategory(Category category) {
   return this.productRepository.getProductListByCategoryId(category.getId());
 }