public async Task <IActionResult> Create([Bind("ProjectTitle,ProjectDescription,ProjectApprovalDate,ProjectStartDatePlanned,ProjectEndDatePlanned,ProjectStartDateRealized,ProjectEndDateRealized,ProjectProgress,EmployeeId,PriorityId,ProcedureModelId,StatusId,Id")] Project project)
        {
            if (ModelState.IsValid)
            {
                _context.Add(project);
                await _context.SaveChangesAsync();

                ProcedureModel procedureModel = _context.ProcedureModels.ToList().Find(_procedureModel => _procedureModel.Id == project.ProcedureModelId);

                List <Phase> generatedPhases = new List <Phase>();

                // Hermes Create Phase
                if (procedureModel.ProcedureModelName == "Hermes")
                {
                    generatedPhases.AddRange(new List <Phase>()
                    {
                        new Phase()
                        {
                            ProjectId = project.Id,
                            PhaseName = "Initialisierung - " + project.ProjectTitle
                        },
                        new Phase()
                        {
                            ProjectId = project.Id,
                            PhaseName = "Konzept - " + project.ProjectTitle
                        },
                        new Phase()
                        {
                            ProjectId = project.Id,
                            PhaseName = "Realisierung - " + project.ProjectTitle
                        },
                        new Phase()
                        {
                            ProjectId = project.Id,
                            PhaseName = "Einführung - " + project.ProjectTitle
                        }
                    }
                                             );
                }

                // V-Modell Create Phase
                if (procedureModel.ProcedureModelName == "V-Modell")
                {
                    generatedPhases.AddRange(new List <Phase>()
                    {
                        new Phase()

                        {
                            ProjectId = project.Id,
                            PhaseName = "Systemanforderungsanalyse - " + project.ProjectTitle
                        },
                        new Phase()
                        {
                            ProjectId = project.Id,
                            PhaseName = "System Architektur und Entwurf - " + project.ProjectTitle
                        },
                        new Phase()
                        {
                            ProjectId = project.Id,
                            PhaseName = "Software Architektur und Entwurf - " + project.ProjectTitle
                        },
                        new Phase()
                        {
                            ProjectId = project.Id,
                            PhaseName = "Unit und Integrations Test - " + project.ProjectTitle
                        },
                        new Phase()
                        {
                            ProjectId = project.Id,
                            PhaseName = "System Integration - " + project.ProjectTitle
                        },
                        new Phase()
                        {
                            ProjectId = project.Id,
                            PhaseName = "Abnahme und Nutzung - " + project.ProjectTitle
                        }
                    }
                                             );
                }

                //  Create Milestones
                if (generatedPhases.Count > 0)
                {
                    _context.AddRange(generatedPhases);
                    await _context.SaveChangesAsync();

                    try
                    {
                        List <Milestone> milestones = new List <Milestone>();
                        foreach (Phase currentPhase in generatedPhases)
                        {
                            milestones.Add(new Milestone()
                            {
                                PhaseId       = currentPhase.Id,
                                ProjectId     = project.Id,
                                MilestoneDate = DateTime.Now,
                                MilestoneName = "Milestone - " + currentPhase.PhaseName
                            });
                        }
                        _context.AddRange(milestones);
                        await _context.SaveChangesAsync();
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Fehler2: " + e.ToString());
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployeeId"]       = new SelectList(_context.Employees, "Id", "EmployeeFirstName", project.EmployeeId);
            ViewData["PriorityId"]       = new SelectList(_context.Priorities, "Id", "PriorityType", project.PriorityId);
            ViewData["ProcedureModelId"] = new SelectList(_context.ProcedureModels, "Id", "ProcedureModelName", project.ProcedureModelId);
            ViewData["StatusId"]         = new SelectList(_context.Set <Status>(), "Id", "StatusType", project.StatusId);
            return(View(project));
        }