AlistairTait12 / FightWaste

The FightWaste console application - get a quick shopping list based on your meal plan
0 stars 0 forks source link

User can enter as many or as little meals as they like #21

Closed AlistairTait12 closed 1 year ago

AlistairTait12 commented 1 year ago

Number of meals added is currently hardcoded as 7 (days in the week). User should just be able to add as many or as few meals as they like and when they type END, it exits the loop and produces the ingredients list.

AlistairTait12 commented 1 year ago

The asking the user and finding of the meals is too tightly coupled in the MealFinder.

Instead, have a class which handles user input (not just meal names) and it depends on a MealFinder.

MealFinder's responsibility will change to just searching for the meal and returning null if not found.

The outer class will respond to user input and the returned values of MealFinder.FindByName().

Another option is to have a non-generic method on ModelRepository<MealModel> which can find by name property (.GetByName(string name))