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) }); }
public override async Task <IViewProviderResult> BuildDisplayAsync(Profile profile, IViewProviderContext context) { var user = await _platoUserStore.GetByIdAsync(profile.Id); if (user == null) { return(await BuildIndexAsync(profile, context)); } var badges = await _badgeEntriesStore.SelectByUserIdAsync(user.Id); var viewModel = new ProfileDisplayViewModel() { User = user, Badges = badges }; return(Views( View <ProfileDisplayViewModel>("Profile.Display.Content", model => viewModel).Zone("content").Order(0) )); }