@page "/links/{id:guid}" @inject LinksClient Links @inject NotificationManager Notifications @if (Item == null) {

Loading...

} else {

@Item.Url

👍 @Item.UpVotes 👎 @Item.DownVotes
@if (Comments == null) {

Loading comments ...

} else if(Comments.Count == 0) {

No comment yet!

} else { foreach (var comment in Comments) { } } } @code { [Parameter] public Guid Id { get; set; } private LinkDto Item; private ICollection Comments; protected override async Task OnInitializedAsync() { Item = await Links.GetLinkByIdAsync(Id); await FetchComments(); } protected async Task FetchComments() { Comments = await Links.CommentsAsync(Id); } private async Task SubmitComment(AddCommentViewModel command) { try { await Links.AddCommentAsync(Id, command); await FetchComments(); Notifications.Add("comment added!"); } catch { Notifications.Add("could not post a comment"); } } }