コード例 #1
0
ファイル: Recipe.cs プロジェクト: blaze6950/BookOfRecipes
 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;
 }
コード例 #2
0
ファイル: Recipe.cs プロジェクト: blaze6950/BookOfRecipes
 public Recipe()
 {
     Id               = 0;
     Name             = String.Empty;
     Ingridients      = new List <Ingridient>();
     Cooking          = String.Empty;
     NumberOfServings = 0;
     CalContent       = new CaloricContent();
 }
コード例 #3
0
ファイル: Recipes.cs プロジェクト: blaze6950/BookOfRecipes
        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();
        }