예제 #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());
 }