示例#1
0
 private Product productDTOTOProduct(ProductDTO productSelect) {
   return new Product(
       productSelect.getId(),
       productSelect.getName(),
       productSelect.getPrice(),
       productSelect.getDescription(),
       productSelect.getDetalle(),
       productSelect.getImage(),
       productSelect.getImageCarrito(),
       productSelect.getCategory().getId());
 }
示例#2
0
  @Override
  public ArrayList<ProductDTO> deleteProduct(ProductDTO productDTO) throws NotLoggedInException {
    Product productItem = null;
    boolean delete = true;
    PersistenceManager pm = getPersistenceManager();
    try {
      productItem = pm.getObjectById(Product.class, productDTO.getId());
      if (delete) {
        pm.deletePersistent(productItem);
      }

    } finally {
      pm.close();
    }

    if (delete) {
      return getProducts();
    } else {
      return null;
    }
  }