diff --git a/Webzine.WebApplication/Controllers/TitreController.cs b/Webzine.WebApplication/Controllers/TitreController.cs index 384f41e..0dbad27 100644 --- a/Webzine.WebApplication/Controllers/TitreController.cs +++ b/Webzine.WebApplication/Controllers/TitreController.cs @@ -52,6 +52,8 @@ namespace Webzine.WebApplication.Controllers return this.RedirectToAction("Index"); } + this.titreRepository.IncrementNbLectures(titre); + var vm = new TitreDetail { Details = new TitreContent @@ -111,10 +113,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 }); }