ajout gestion des jeux (ajout, modif, suppr) et maj journal séance 3

This commit is contained in:
2026-06-05 23:56:12 +02:00
parent 3ae04250f0
commit dab366607a
7 changed files with 209 additions and 9 deletions
@@ -56,6 +56,39 @@ class Game_model extends CI_Model {
return $query->row_array();
}
public function ajouter_jeu($titre, $annee, $description, $prix) {
$donnees = array(
'name' => $titre,
'releaseYear' => $annee,
'shortDescription' => $description,
'price' => empty($prix) ? NULL : $prix
);
return $this->db->insert('game', $donnees);
}
public function supprimer_jeu($id) {
return $this->db->delete('game', array('id' => $id));
}
public function get_jeu($id) {
$leJeu = $this->db->get_where('game', array('id' => $id));
return $leJeu->row_array();
}
public function modifier_jeu($id, $titre, $annee, $description, $prix) {
$donnees = array(
'name' => $titre,
'releaseYear' => $annee,
'shortDescription' => $description,
'price' => empty($prix) ? NULL : $prix
);
$this->db->where('id', $id);
return $this->db->update('game', $donnees);
}
}