#include "commodityservice.h" #include "commodity-odb.hxx" CommodityService::CommodityService() { } QList > CommodityService::shopItems() { QList > ret; foreach (QSharedPointer data, all()) { ret.append(qSharedPointerDynamicCast(data)); } return ret; } void CommodityService::addedToVoucher(int itemId, int countAdded) { QSharedPointer commodity = loadById(itemId); if (!commodity.isNull()) { commodity->setCount(commodity->count() - countAdded); } update(commodity); }