修复添加化妆品无法更改过期时间的bug
This commit is contained in:
@@ -58,11 +58,12 @@ Cosmetic* CosmeticManager::findCosmetic(const std::string& name) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool CosmeticManager::modifyCosmetic(const std::string& name, double newPrice, bool newType) {
|
||||
bool CosmeticManager::modifyCosmetic(const std::string &name, double newPrice, bool newType, std::string expirationDate) {
|
||||
Cosmetic* cosmetic = findCosmetic(name);
|
||||
if (cosmetic) {
|
||||
cosmetic->setPrice(newPrice);
|
||||
cosmetic->setType(newType);
|
||||
cosmetic->setExpirationDate(expirationDate);
|
||||
saveToFile();
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user