function Create($name, $seats, $description, $buttonPress) { $name = $name == "null" ? null : $name; $seats = $seats == "null" ? null : $seats; $description = $description == "null" ? null : $description; $buttonPress = $buttonPress == "null" ? null : $buttonPress; $plane = new Plane(); $plane->set($name, $seats, $description); $this->modelView->plane = $plane; $this->modelView->planeModel = new PlaneModel($plane); if ($plane->validated()) { if (!$this->modelView->planeModel->IsExists()) { $this->modelView->planeModel->Add(); ContextManager::ValidationFor("warning", "Successfully added"); $this->modelView->plane = null; } else { ContextManager::ValidationFor("warning", "The current plane [{$name}] name already exists"); } } else { ContextManager::ValidationFor("warning", $plane->getError()); } $this->ViewBag("Title", "Add Plane"); $this->ViewBag("Controller", "Plane"); $this->ViewBag("Page", "Index"); return $this->View($this->modelView, "Account", "Index"); }