ajout lien vers la page de détail

This commit is contained in:
Julien LEICHER 2021-12-13 15:33:50 +01:00
parent 4e34679168
commit 849d4e2260
No known key found for this signature in database
GPG Key ID: BE0761B6A007EB96
2 changed files with 23 additions and 7 deletions

View File

@ -4,4 +4,8 @@
<h3 class="text-indigo-500 font-semibold text-xl"><a href="@Model.Url">@Model.Url</a></h3> <h3 class="text-indigo-500 font-semibold text-xl"><a href="@Model.Url">@Model.Url</a></h3>
<p>@Model.Description</p> <p>@Model.Description</p>
<div>
<a asp-controller="Links" asp-action="Detail" asp-route-id="@Model.Id">Détail du lien</a>
</div>
</article> </article>

View File

@ -21,12 +21,24 @@ public class MemoryLinkRepository : ILinkRepository, IReadStore
public LinkHomePage[] GetPublishedLinks() public LinkHomePage[] GetPublishedLinks()
{ {
return _links.Select(l => new LinkHomePage // return (from l in _links
{ // orderby l.CreatedAt descending
Id = l.Id, // select new LinkHomePage
Url = l.Url, // {
Description = l.Description, // Id = l.Id,
CommentsCount = 0, // Url = l.Url,
}).ToArray(); // 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();
} }
} }