public async override Task <ActionResult> Index(ContentModel contentModel) { if (contentModel is null) { throw new ArgumentNullException(nameof(contentModel)); } var model = new StatisticsViewModel <BestStatistic>(contentModel.Content, Services?.UserService) { ShowCaption = false }; model.DefaultFilter = await _statisticsFilterFactory.FromRoute(Request.Url.AbsolutePath).ConfigureAwait(false); model.AppliedFilter = _statisticsFilterQueryStringParser.ParseQueryString(model.DefaultFilter, HttpUtility.ParseQueryString(Request.Url.Query)); if (model.AppliedFilter.Team != null) { model.ShowTeamsColumn = false; } model.Results = (await _statisticsDataSource.ReadMostWickets(model.AppliedFilter).ConfigureAwait(false)).ToList(); model.AppliedFilter.Paging.PageUrl = Request.Url; model.AppliedFilter.Paging.Total = await _statisticsDataSource.ReadTotalPlayersWithWickets(model.AppliedFilter).ConfigureAwait(false); _statisticsBreadcrumbBuilder.BuildBreadcrumbs(model.Breadcrumbs, model.AppliedFilter); model.FilterDescription = _statisticsFilterHumanizer.EntitiesMatchingFilter("Wickets", _statisticsFilterHumanizer.MatchingUserFilter(model.AppliedFilter)); model.Metadata.PageTitle = "Most wickets" + _statisticsFilterHumanizer.MatchingFixedFilter(model.AppliedFilter) + _statisticsFilterHumanizer.MatchingUserFilter(model.AppliedFilter); return(CurrentTemplate(model)); }
public async override Task <ActionResult> Index(ContentModel contentModel) { if (contentModel is null) { throw new ArgumentNullException(nameof(contentModel)); } var model = new StatisticsViewModel <PlayerInnings>(contentModel.Content, Services?.UserService) { ShowCaption = false }; model.DefaultFilter = await _statisticsFilterFactory.FromRoute(Request.Url.AbsolutePath).ConfigureAwait(false); model.AppliedFilter = _statisticsFilterQueryStringParser.ParseQueryString(model.DefaultFilter, HttpUtility.ParseQueryString(Request.Url.Query)); var catchesFilter = model.AppliedFilter.Clone(); catchesFilter.Player = null; catchesFilter.CaughtByPlayerIdentityIds = model.AppliedFilter.Player.PlayerIdentities.Select(x => x.PlayerIdentityId.Value).ToList(); model.Results = (await _playerPerformanceDataSource.ReadPlayerInnings(catchesFilter).ConfigureAwait(false)).ToList(); model.AppliedFilter.Paging.PageUrl = Request.Url; model.AppliedFilter.Paging.Total = (await _playerSummaryStatisticsDataSource.ReadFieldingStatistics(model.AppliedFilter).ConfigureAwait(false)).TotalCatches; _statisticsBreadcrumbBuilder.BuildBreadcrumbs(model.Breadcrumbs, model.AppliedFilter); model.FilterDescription = _statisticsFilterHumanizer.EntitiesMatchingFilter("Catches", _statisticsFilterHumanizer.MatchingUserFilter(model.AppliedFilter)); model.Metadata.PageTitle = "Catches" + _statisticsFilterHumanizer.MatchingFixedFilter(model.AppliedFilter) + _statisticsFilterHumanizer.MatchingUserFilter(model.AppliedFilter); return(CurrentTemplate(model)); }