Exemplo n.º 1
0
 @Override
 public boolean addItem(String name, String category, int stock, float price) {
   Iterable<Item> iitems = itemRepository.findAll();
   for (Item it : iitems) {
     if (it.getName().equalsIgnoreCase(name)) return false;
   }
   item = ItemFactory.createItem(name, category, stock, price, orderlines);
   itemRepository.save(item);
   return true;
 }
 @Override
 public List<Item> viewAllItems() {
   List<Item> items = new ArrayList<Item>();
   Iterable<Item> iitems = itemRepository.findAll();
   for (Item item : iitems) items.add(item);
   return items;
 }