using Microsoft.AspNetCore.Components; using Blog3000.Shared; using System; using System.Collections.Generic; using System.Linq; namespace Blog3000.Client.Shared { public partial class TopicContent { [Parameter] public TopTopics.Topic Topic { get; set; } [Parameter] public TopTopics Owner { get; set; } private List sortedPosts; protected override void OnInitialized() { var s = new List(Topic?.Posts); s.Sort((a, b) => DateTime.Compare( b.Revisions?.Latest()?.ChangedAt ?? DateTime.MinValue, a.Revisions?.Latest()?.ChangedAt ?? DateTime.MinValue)); sortedPosts = s.Take(5).ToList(); } private void TopicClicked(string topic) { //System.Diagnostics.Debug.WriteLine(topic); Owner?.OnTopicClick.InvokeAsync(topic); } } }