示例#1
0
 public Ingredient(string name, Dictionary <string, int> nutritionalValues, string quantityUnit = "grams", List <string> allergyList = null)
 {
     Name = name;
     NutritionalValues = nutritionalValues;
     QuantityUnit      = quantityUnit;
     AllergyList       = new AllergyWarnings(allergyList);
 }
示例#2
0
        public Recipe(string name, string description, int time, int portions, List <string> cookingSteps, Dictionary <Ingredient, int> ingredients, List <string> commentary = null, User user = null)
        {
            Name         = name;
            Description  = description;
            Time         = time;
            Portions     = portions;
            CookingSteps = cookingSteps;
            Ingredients  = ingredients;
            Commentary   = commentary;

            var allergyLists = new List <AllergyWarnings>();

            foreach (var ingredient in Ingredients)
            {
                allergyLists.Add(ingredient.Key.AllergyList);
            }
            AllergyWarnings = new AllergyWarnings(allergyLists);

            NutritionTable = CreateNutritionTable();

            User = user ?? User.GetDefaultUser();
        }