#199 La méthode pour supprimer un titre est renommée et prend un id au lieu du modèle. Ajout d'un try catch sur artiste controller pour debugger l'ajout d'un artiste.

This commit is contained in:
josephine.vetu
2026-04-06 19:08:56 +02:00
parent 0e8c320478
commit 425ab13617
4 changed files with 19 additions and 25 deletions

View File

@@ -81,8 +81,16 @@ public class ArtisteController : Controller
Biographie = model.Biographie,
};
// Persister les données.
this.artisteRepository.Add(artiste);
try
{
this.artisteRepository.Add(artiste);
this.logger.LogInformation("Création d'un nouvel artiste: {Nom}", artiste.Nom);
}
catch (Exception ex)
{
this.logger.LogError(ex, "Erreur lors de la création de l'artiste: {Nom}", artiste.Nom);
return this.View(model);
}
// Renvoyer sur la page Index.
return this.RedirectToAction("Index");