public AddRecipeViewModel()
        {
            #region Init Commands
            #region Init Phase - Commands
            AddPhaseCommand          = new RelayCommand(AddPhaseExecute);
            DuplicatePhaseCommand    = new RelayCommand(DuplicatePhaseExecute);
            DeletePhaseCommand       = new RelayCommand(DeletePhaseExecute);
            PositionUpPhaseCommand   = new RelayCommand(PositionUpPhaseExecute, PositionUpPhaseCanExecute);
            PositionDownPhaseCommand = new RelayCommand(PositionDownPhaseExecute, PositionDownPhaseCanExecute);
            AddPumpIntervalCommand   = new RelayCommand(AddPumpIntervalExecute);
            #endregion

            #region Init Ingredient - Commands
            AddIngredientCommand       = new RelayCommand(AddIngredientExecute);
            DuplicateIngredientCommand = new RelayCommand(DuplicateIngredientExecute);
            DeleteIngredientCommand    = new RelayCommand(DeleteIngredientExecute);
            #endregion

            SaveRecipeCommand = new RelayCommand(SaveRecipeExecute, SaveRecipeCanExecute);
            #endregion

            using var db  = new BreweryContext();
            PumpIntervals = new ObservableCollection <PumpInterval>(db.PumpIntervals.ToList());

            foreach (var ingredient in db.FoundationIngrediets.ToList())
            {
                RecipeIngredients.Add(new Ingredient {
                    Name = ingredient.Name, Amount = ingredient.Amount, Typ = ingredient.Typ
                });
            }

            RecipePhases.Add(new Phase {
                Position = 0, Name = "Aufwärmen", PeriodOfMinutes = 60, TargetTemperature = 50, Typ = PhaseTyp.HeatUp, PumpInterval = PumpIntervals[0]
            });
            RecipePhases.Add(new Phase {
                Position = 1, Name = "Halten", PeriodOfMinutes = 60, TargetTemperature = 50, Typ = PhaseTyp.KeepHeat, PumpInterval = PumpIntervals[2]
            });
            RecipePhases.Add(new Phase {
                Position = 2, Name = "Aufwärmen 2", PeriodOfMinutes = 60, TargetTemperature = 70, Typ = PhaseTyp.HeatUp, PumpInterval = PumpIntervals[2]
            });
            RecipePhases.Add(new Phase {
                Position = 3, Name = "Rast 2", PeriodOfMinutes = 60, TargetTemperature = 70, Typ = PhaseTyp.KeepHeat, PumpInterval = PumpIntervals[2]
            });
        }
        private void AddPhaseExecute(object obj)
        {
            if (obj is Phase phase)
            {
                Phase newPhase = new Phase {
                    Position = RecipePhases.Count, Name = phase.Name, PeriodOfMinutes = phase.PeriodOfMinutes, TargetTemperature = phase.TargetTemperature, Typ = phase.Typ, PumpInterval = phase.PumpInterval
                };

                RecipePhases.Add(newPhase);
            }
            else
            {
                int targetTemperature = 0;
                if (RecipePhases.Count > 0)
                {
                    targetTemperature = RecipePhases[RecipePhases.Count - 1].TargetTemperature;
                }
                RecipePhases.Add(new Phase {
                    Position = RecipePhases.Count, Name = "", PeriodOfMinutes = 0, TargetTemperature = targetTemperature, Typ = PhaseTyp.KeepHeat, PumpInterval = PumpIntervals[0]
                });
            }
        }