From a52c08ec326543d13f374dc2a65e3bcecb251f59 Mon Sep 17 00:00:00 2001 From: mirage <119869686+ClementBobin@users.noreply.github.com> Date: Tue, 31 Mar 2026 15:32:19 +0200 Subject: [PATCH] feat: incrementer le nombre de lectures et de likes dans TitreController --- Webzine.WebApplication/Controllers/TitreController.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Webzine.WebApplication/Controllers/TitreController.cs b/Webzine.WebApplication/Controllers/TitreController.cs index 01b1239..e4c0cd7 100644 --- a/Webzine.WebApplication/Controllers/TitreController.cs +++ b/Webzine.WebApplication/Controllers/TitreController.cs @@ -53,6 +53,8 @@ namespace Webzine.WebApplication.Controllers return this.RedirectToAction("Index"); } + this.titreRepository.IncrementNbLectures(titre); + var vm = new TitreDetail { Details = new TitreContent @@ -113,10 +115,11 @@ namespace Webzine.WebApplication.Controllers if (titre == null) { this.logger.LogWarning("Impossible d'ajouter un like. Titre ID {Id} introuvable.", model.IdTitre); - return this.RedirectToAction("Index"); } - - titre.NbLikes++; + else + { + this.titreRepository.IncrementNbLikes(titre); + } return this.RedirectToAction("Details", new { id = model.IdTitre }); }