From 849d4e2260bcf7b2b349dd2876f1c9749d035bb6 Mon Sep 17 00:00:00 2001 From: Julien LEICHER Date: Mon, 13 Dec 2021 15:33:50 +0100 Subject: [PATCH] =?UTF-8?q?ajout=20lien=20vers=20la=20page=20de=20d=C3=A9t?= =?UTF-8?q?ail?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/Shared/_LinkCard.cshtml | 4 +++ .../Memory/MemoryLinkRepository.cs | 26 ++++++++++++++----- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/Apps/HackerNet.Web/Views/Shared/_LinkCard.cshtml b/Apps/HackerNet.Web/Views/Shared/_LinkCard.cshtml index a07e432..2703567 100644 --- a/Apps/HackerNet.Web/Views/Shared/_LinkCard.cshtml +++ b/Apps/HackerNet.Web/Views/Shared/_LinkCard.cshtml @@ -4,4 +4,8 @@

@Model.Url

@Model.Description

+ +
+ Détail du lien +
\ No newline at end of file diff --git a/HackerNet.Infrastructure/Repositories/Memory/MemoryLinkRepository.cs b/HackerNet.Infrastructure/Repositories/Memory/MemoryLinkRepository.cs index 7682607..40b9f10 100644 --- a/HackerNet.Infrastructure/Repositories/Memory/MemoryLinkRepository.cs +++ b/HackerNet.Infrastructure/Repositories/Memory/MemoryLinkRepository.cs @@ -21,12 +21,24 @@ public class MemoryLinkRepository : ILinkRepository, IReadStore public LinkHomePage[] GetPublishedLinks() { - return _links.Select(l => new LinkHomePage - { - Id = l.Id, - Url = l.Url, - Description = l.Description, - CommentsCount = 0, - }).ToArray(); + // return (from l in _links + // orderby l.CreatedAt descending + // select new LinkHomePage + // { + // Id = l.Id, + // Url = l.Url, + // Description = l.Description, + // CommentsCount = 0, + // }).ToArray(); + + return _links + .OrderByDescending(l => l.CreatedAt) + .Select(l => new LinkHomePage + { + Id = l.Id, + Url = l.Url, + Description = l.Description, + CommentsCount = 0, + }).ToArray(); } } \ No newline at end of file