Ejemplo n.º 1
0
 public OrderStatus buy(int aItemId, int quantity) throws UnknownArticleException {
   Item orderedItem = stockDao.getItem(aItemId);
   if (orderedItem == null) {
     throw new UnknownArticleException();
   }
   if (stockDao.addOrder(orderedItem, quantity)) {
     return new OrderStatus(orderedItem, ++orderId);
   } else {
     return new OrderStatus(orderedItem);
   }
 }
Ejemplo n.º 2
0
 public List listStock() {
   return stockDao.getCurrentStock();
 }