From da4179a0655d5ba2433f6feaa6806a35d874c2a3 Mon Sep 17 00:00:00 2001 From: Julien LEICHER Date: Tue, 14 Dec 2021 09:06:56 +0100 Subject: [PATCH] =?UTF-8?q?ajout=20du=20d=C3=A9tail=20d'un=20lien?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Apps/HackerNet.Web/Controllers/LinksController.cs | 10 +++++++++- Apps/HackerNet.Web/Views/Links/Detail.cshtml | 6 ++++++ Apps/HackerNet.Web/Views/Shared/_Layout.cshtml | 2 +- Apps/HackerNet.Web/Views/Shared/_LinkCard.cshtml | 6 +++--- HackerNet.Application/LinkService.cs | 8 +++++--- .../Repositories/Memory/MemoryLinkRepository.cs | 11 ++++++++++- 6 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 Apps/HackerNet.Web/Views/Links/Detail.cshtml diff --git a/Apps/HackerNet.Web/Controllers/LinksController.cs b/Apps/HackerNet.Web/Controllers/LinksController.cs index cd24de0..7eaab5a 100644 --- a/Apps/HackerNet.Web/Controllers/LinksController.cs +++ b/Apps/HackerNet.Web/Controllers/LinksController.cs @@ -1,5 +1,4 @@ using HackerNet.Application; -using HackerNet.Infrastructure.Repositories.Memory; using Microsoft.AspNetCore.Mvc; namespace HackerNet.Web.Controllers; @@ -21,6 +20,14 @@ public class LinksController : Controller // return View(_linkRepository.GetAll());// retourne Link[] } + // TODO: Page de détail d'un lien + + [HttpGet] + public IActionResult Detail(Guid id) + { + return View(_linkService.GetLinkDetail(id)); + } + [HttpGet] public IActionResult New() { @@ -28,6 +35,7 @@ public class LinksController : Controller } [HttpPost] + [ValidateAntiForgeryToken] public IActionResult New(PublishLinkCommand cmd) { if (!ModelState.IsValid) diff --git a/Apps/HackerNet.Web/Views/Links/Detail.cshtml b/Apps/HackerNet.Web/Views/Links/Detail.cshtml new file mode 100644 index 0000000..486375f --- /dev/null +++ b/Apps/HackerNet.Web/Views/Links/Detail.cshtml @@ -0,0 +1,6 @@ +@model HackerNet.Application.LinkHomePage +@{ + ViewData["Title"] = $"Détail du lien {Model.Url}"; +} + + \ No newline at end of file diff --git a/Apps/HackerNet.Web/Views/Shared/_Layout.cshtml b/Apps/HackerNet.Web/Views/Shared/_Layout.cshtml index 2cbb0ce..65a770b 100644 --- a/Apps/HackerNet.Web/Views/Shared/_Layout.cshtml +++ b/Apps/HackerNet.Web/Views/Shared/_Layout.cshtml @@ -7,7 +7,7 @@ -
+