using System.Collections.Generic;
public string Name { get; set; }
public string Name { get; set; }
public string Name { get; set; }
public User user { get; set; }
public Ingredient ing { get; set; }
public int quantity { get; set; }
public Recipe recipe { get; set; }
public Ingredient ing { get; set; }
public int quantity { get; set; }
public static void Main()
User shai = new User { Name = "Gidon" };
User ali = new User { Name = "ניסיתי ככה" };
Recipe pasta = new Recipe { Name = "pasta" };
Recipe pizza = new Recipe { Name = "pizza" };
Recipe burger = new Recipe { Name = "burger" };
Ingredient noodles = new Ingredient { Name = "noodles" };
Ingredient cheese = new Ingredient { Name = "cheese" };
Ingredient pepperoni = new Ingredient { Name = "cow #743875287" };
Ingredient buns = new Ingredient { Name = "buns" };
Ingredient sheep = new Ingredient { Name = "sheep" };
List<User_ing> user_ingredients = new List<User_ing> {
new User_ing { user = ali, ing = cheese, quantity = 1 },
new User_ing { user = ali, ing = pepperoni, quantity = 1 },
new User_ing { user = ali, ing = noodles, quantity = 1 },
new User_ing { user = ali, ing = sheep, quantity = 1 },
new User_ing { user = ali, ing = buns, quantity = 1 }
List<Recipe_ing> recipe_ingredients = new List<Recipe_ing> {
new Recipe_ing { recipe = pasta, ing = noodles, quantity = 1 },
new Recipe_ing { recipe = pizza, ing = cheese, quantity = 1 },
new Recipe_ing { recipe = pizza, ing = pepperoni, quantity = 1 },
new Recipe_ing { recipe = burger, ing = buns, quantity = 3 },
new Recipe_ing { recipe = burger, ing = sheep, quantity = 1 }
List<Recipe> recipes = new List<Recipe> { pasta, pizza, burger };
var ali_ingredients = user_ingredients.Where(ui => ui.user == ali);
var ali_potential_recipes = recipes.Where(
r => !recipe_ingredients.Any(ri =>
!ali_ingredients.Any(ui => ui.ing.Name == ri.ing.Name && ui.quantity >= ri.quantity)
Console.WriteLine("Ali's potential recipes:\n");
foreach (var obj in ali_potential_recipes)