Ejemplo n.º 1
0
 public Recipe(string name, List <Ingridient> ingridients, string cooking, int numberOfServings, CaloricContent calContent, int id = 0)
 {
     Id               = id;
     Name             = name;
     Ingridients      = ingridients;
     Cooking          = cooking;
     NumberOfServings = numberOfServings;
     CalContent       = calContent;
 }
Ejemplo n.º 2
0
 public Recipe()
 {
     Id               = 0;
     Name             = String.Empty;
     Ingridients      = new List <Ingridient>();
     Cooking          = String.Empty;
     NumberOfServings = 0;
     CalContent       = new CaloricContent();
 }
Ejemplo n.º 3
0
        public void AddRecipe(String newName, List <Ingridient> newIngridients, String newCooking, Int32 newNumberOfServings, CaloricContent newCalContent)
        {
            Recipe newRecipe = new Recipe();

            newRecipe.Name             = newName;
            newRecipe.Ingridients      = newIngridients;
            newRecipe.Cooking          = newCooking;
            newRecipe.NumberOfServings = newNumberOfServings;
            newRecipe.CalContent       = newCalContent;
            if (_recipes != null && _recipes.Count > 0)
            {
                newRecipe.Id = _recipes.Last().Id;
            }
            else
            {
                newRecipe.Id = 1;
            }
            if (_recipes != null)
            {
                _recipes.Add(newRecipe);
            }
            WriteData();
        }