// GET: Stats/All public async Task <ActionResult> All() { List <PlayerDTO> players = await playerService.GetPlayersAsync(); List <MatchDTO> matches = await matchesService.GetMatchesAsync(); StatsCompositeViewModel viewmodel = new StatsCompositeViewModel(players, matches); viewmodel.PlayerStats.Sort((a, b) => a.MatchScore.CompareTo(b.MatchScore)); return(View(viewmodel.PlayerStats)); }
// GET: Stats/Detail/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } List <MatchDTO> stats = await statsService.GetStats(id.Value); if (stats == null) { return(HttpNotFound()); } List <PlayerDTO> players = await playerService.GetPlayersAsync(); List <MatchDTO> matches = await matchesService.GetMatchesAsync(); StatsCompositeViewModel viewmodel = new StatsCompositeViewModel(players, matches); return(View(viewmodel.GetSinglePlayerById(id.Value))); }