示例#1
0
        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)
            });
        }
示例#2
0
        public override async Task <IViewProviderResult> BuildIndexAsync(Badge badge, IViewProviderContext context)
        {
            var badges = await _badgeEntriesStore.SelectAsync();

            var viewModel = new BadgesIndexViewModel()
            {
                Badges = badges
            };

            return(Views(View <BadgesIndexViewModel>("Home.Index.Header", model => viewModel).Zone("header"),
                         View <BadgesIndexViewModel>("Home.Index.Tools", model => viewModel).Zone("tools"),
                         View <BadgesIndexViewModel>("Home.Index.Content", model => viewModel).Zone("content")
                         ));
        }