public async Task <IViewComponentResult> InvokeAsync( BadgesIndexOptions options) { if (options == null) { options = new BadgesIndexOptions(); } return(View(await GetViewModel(options))); }
async Task <BadgesIndexViewModel> GetViewModel(BadgesIndexOptions options) { var entries = options.UserId > 0 ? await _badgeEntriesStore.SelectByUserIdAsync(options.UserId) : await _badgeEntriesStore.SelectAsync(); return(new BadgesIndexViewModel() { Badges = options.UserId > 0 ? entries?.OrderByDescending(b => b.Details.LastAwardedDate) : entries?.OrderBy(b => b.Level) }); }