Exemplo n.º 1
0
        public string ConvertToString(AbstractRecipe recipe) // lokalna metoda zwracająca listę składników w postaci stringa,
        {                                                    //żeby ułatwić jego zapisanie w bazie danych
            string output = "";                              //pole na docelowy string

            Converter = new RecipeConverter();               //zawiera narzędzia służące konwertowaniu typu Recipe na string i na odwrót
            for (int i = 0; i < recipe.ListOfIngredients.Count; i++)
            {
                output += Converter.FromIngredientToString(recipe.ListOfIngredients[i]);//dodaje kolejne nazwy i ilości do "output"
                if (i < recipe.ListOfIngredients.Count - 1)
                {
                    output += ";";//rozdziela kolejne składniki średnikiem
                }
            }
            return(output);
        }
Exemplo n.º 2
0
        public string ConvertToString(AbstractRecipe recipe) // zwraca listę składników w postaci stringa
        {
            string output = "";

            Converter = new RecipeConverter();

            for (int i = 0; i < recipe.ListOfIngredients.Count; i++)
            {
                output += Converter.FromIngredientToString(recipe.ListOfIngredients[i]);
                if (i < recipe.ListOfIngredients.Count - 1)
                {
                    output += ";";
                }
            }
            return(output);
        }
Exemplo n.º 3
0
 public List <AbstractIngredient> ConvertToRecipe(string recipeAsString)
 {
     Converter = new RecipeConverter();
     return(Converter.FromStringToListOfIngredients(recipeAsString));
 }