Skip to content

Instantly share code, notes, and snippets.

@tadas-subonis
Created December 27, 2012 00:26
Show Gist options
  • Save tadas-subonis/4384333 to your computer and use it in GitHub Desktop.
Save tadas-subonis/4384333 to your computer and use it in GitHub Desktop.
String orderId = request.getParam("id");
String sku = request.getParam("sku");
Order order = orderDao.findOneById(orderId);
Item item = itemDao.findOneBySku(sku);
order.addItem(item);
double total = 0.0;
for (Item item : order.getItems()) {
total += item.getPrice();
}
order.setTotalPrice(total);
order.setLastUpdated(new Date());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment