prestation/Controleur/ControleurAjaxtbajouterservice.php
2025-12-01 18:54:33 +00:00

32 lines
997 B
PHP

<?php
require_once 'Framework/Controleur.php';
require_once 'Modele/Tabservice.php';
class ControleurAjaxtbajouterservice extends Controleur {
private $service;
public function __construct() {
$this->service = new Tabservice();
}
public function index() {
$this->genererVueAjax();
}
public function ajouter(){
$codeService = strtoupper($this->requete->getParametreFormulaire("codeService"));
if (!$this->service->existeligne($codeService)){
$libelle = strtoupper($this->requete->getParametreFormulaire("libelle"));
$libelleEng = strtoupper($this->requete->getParametreFormulaire("libelleEng"));
$this->service->ajouterservice($codeService,$libelle,$libelleEng);
}else{
echo 'Erreur: Le code saisi existe déjà! Veuillez entrer un autre./Error : The code entered already exists! Please enter another.';
die();
}
}
}