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";
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (!restaurantOwner.getRestaurants().empty())
|
||||
{
|
||||
std::cout << "Invalid Index. Cannot display Menu Items!\n";
|
||||
return;
|
||||
@@ -415,7 +415,7 @@ void FoodDeliveryController::addMenuItem() const
|
||||
restaurantIterator->second->addMenuItem(menuItem);
|
||||
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";
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user