public virtual async Task <ActionResult> Index() { var leaderboardCollection = await LeaderboardCollection.GetLeaderboardAsync(); var leaderboardIndexViewModel = new LeaderboardIndexViewModel(); var allBadges = await BadgeCollection.GetAllBadgesByTypeAsync(BadgeType.Unset); leaderboardIndexViewModel.TopTenCorporateBadgeHolders = leaderboardCollection .OrderByDescending(li => li.EarnedCorporateBadgeCount) .Take(10); leaderboardIndexViewModel.TopTenCommunityBadgeHolders = leaderboardCollection .OrderByDescending(li => li.EarnedCommunityBadgeCount) .Take(10); leaderboardIndexViewModel.TotalCorporateBadgeCount = allBadges .Where(bi => bi.Type == BadgeType.Corporate) .Count(); leaderboardIndexViewModel.TotalCommunityBadgeCount = allBadges .Where(bi => bi.Type == BadgeType.Community) .Count(); return(View(leaderboardIndexViewModel)); }
public async virtual Task <ActionResult> Index() { var allBadges = await BadgeCollection.GetAllBadgesByTypeAsync(BadgeType.Unset); var allEarnedBadges = await EarnedBadgeCollection.GetAllBadgesForUserByTypeAsync(AuthenticatedUser.EmployeeId, BadgeType.Unset); var allActivities = await ActivityCollection.GetAllActivitiesAsync(true); var corporateBadges = allBadges.Where(b => b.Type == BadgeType.Corporate); var communityBadges = allBadges.Where(b => b.Type == BadgeType.Community); var earnedCorporateBadges = allEarnedBadges.Where(b => b.Type == BadgeType.Corporate); var earnedCommunityBadges = allEarnedBadges.Where(b => b.Type == BadgeType.Community); var sortedCorporateBadges = corporateBadges.OrderByDescending(b => b.BadgePriority); var sortedCommunityBadges = communityBadges.OrderByDescending(b => b.BadgePriority); var badgeIndexViewModel = new BadgeIndexViewModel() { CorporateBadges = sortedCorporateBadges, CorporateEarnedBadges = earnedCorporateBadges, CommunityBadges = sortedCommunityBadges, CommunityEarnedBadges = earnedCommunityBadges, SubmittedActivity = SubmitActivity.CreateActivitySubmission(AuthenticatedUser.EmployeeId), AvailableUsers = await UserCollection.GetAllAvailabileUsersForCurrentUserAsync(), }; badgeIndexViewModel.AllActivities = allActivities; badgeIndexViewModel.PossibleActivities = allActivities.Select(ai => new SelectListItem() { Text = ai.Name, Value = ai.Id.ToString(CultureInfo.CurrentCulture) }); return(View(badgeIndexViewModel)); }
public async virtual Task <ActionResult> Index() { var corporateBadges = await BadgeCollection.GetAllBadgesByTypeAsync(BadgeType.Corporate); var communityBadges = await BadgeCollection.GetAllBadgesByTypeAsync(BadgeType.Community); var badgeManagerIndexViewModel = new BadgeManagerIndexViewModel() { CorporateBadges = corporateBadges, CommunityBadges = communityBadges, }; return(View(badgeManagerIndexViewModel)); }
public virtual async Task <ActionResult> Compare(string userName) { var leftLeaderboardItem = await LeaderboardItem.GetLeaderboardForUserName(AuthenticatedUser.UserName); var rightLeaderboardItem = await LeaderboardItem.GetLeaderboardForUserName(userName); var allBadges = await BadgeCollection.GetAllBadgesByTypeAsync(BadgeType.Unset); var allActivities = await ActivityCollection.GetAllActivitiesAsync(false); var leaderboardCompareViewModel = new LeaderboardCompareViewModel(); leaderboardCompareViewModel.LeftLeaderboardItem = leftLeaderboardItem; leaderboardCompareViewModel.RightLeaderboardItem = rightLeaderboardItem; leaderboardCompareViewModel.AllBadges = allBadges; leaderboardCompareViewModel.AllActivities = allActivities; return(View(leaderboardCompareViewModel)); }