fix: Only display Invalid Index in listMenuItems() and addMenuItems() if owner has any restaurants
This commit is contained in:
@@ -377,7 +377,7 @@ void FoodDeliveryController::listMenuItems() const
|
|||||||
<< "\n";
|
<< "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (!restaurantOwner.getRestaurants().empty())
|
||||||
{
|
{
|
||||||
std::cout << "Invalid Index. Cannot display Menu Items!\n";
|
std::cout << "Invalid Index. Cannot display Menu Items!\n";
|
||||||
return;
|
return;
|
||||||
@@ -415,7 +415,7 @@ void FoodDeliveryController::addMenuItem() const
|
|||||||
restaurantIterator->second->addMenuItem(menuItem);
|
restaurantIterator->second->addMenuItem(menuItem);
|
||||||
std::cout << "Added new Menu Item " << menuItem.getName() << " with ID " << menuItem.getId() << " to Restaurant " << restaurantIterator->second->getName() << " successfully\n";
|
std::cout << "Added new Menu Item " << menuItem.getName() << " with ID " << menuItem.getId() << " to Restaurant " << restaurantIterator->second->getName() << " successfully\n";
|
||||||
}
|
}
|
||||||
else
|
else if (!restaurantOwner.getRestaurants().empty())
|
||||||
{
|
{
|
||||||
std::cout << "Invalid Index. Cannot add new Menu Item!\n";
|
std::cout << "Invalid Index. Cannot add new Menu Item!\n";
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user