#include "commodityservice.h" 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); } IShopItemPtr CommodityService::shopItem(int itemId) { CommodityDataPtr item = this->loadById(itemId); return qSharedPointerDynamicCast(item); } ISeller *CommodityService::seller() { return nullptr; } QString CommodityService::defaultSort() { return "name"; }