Пример #1
0
 public static IEnumerable <Ingredient> Ingredients(this FoodOrder foodOrder) =>
 foodOrder.FoodNavigation.FoodIngredient
 .Select(fi => fi.IngredientNavigation)
 .Except(foodOrder.FoodOrderIngredient.Where(foi => foi.Isremoval).Select(foi => foi.IngredientNavigation))
 .Concat(foodOrder.FoodOrderIngredient.Where(foi => !foi.Isremoval).Select(foi => foi.IngredientNavigation));
Пример #2
0
 public static string Key(this FoodOrder foodOrder) =>
 $"{foodOrder.FoodNavigation.Name};{string.Join(";", foodOrder.FoodOrderIngredient.Select(foi => foi.IngredientNavigation.Name))}";
Пример #3
0
 public static decimal Price(this FoodOrder foodOrder) =>
 foodOrder.FoodOrderIngredient
 .Where(i => !i.Isremoval)
 .Sum(i => i.IngredientNavigation.Price ?? 0) + foodOrder.FoodNavigation.Price;