public virtual ActionResult Details(int?id, ApplicationUser currentUser) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } GameDefinitionDetailsViewModel gamingGroupGameDefinitionViewModel; try { var gameDefinitionSummary = _gameDefinitionRetriever.GetGameDefinitionDetails(id.Value, NUMBER_OF_RECENT_GAMES_TO_SHOW); var playerIds = gameDefinitionSummary.PlayerWinRecords.Select(x => x.PlayerId).ToList(); var registeredUserEmailAddressesDictionary = _playerRetriever.GetRegisteredUserEmailAddresses(playerIds, currentUser); gamingGroupGameDefinitionViewModel = _gameDefinitionTransformation.Build(gameDefinitionSummary, registeredUserEmailAddressesDictionary, currentUser); } catch (KeyNotFoundException) { return(new HttpNotFoundResult()); } catch (UnauthorizedAccessException) { return(new HttpUnauthorizedResult()); } return(View(MVC.GameDefinition.Views.Details, gamingGroupGameDefinitionViewModel)); }
public virtual ActionResult Details(int?id, ApplicationUser currentUser) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } GameDefinitionSummary gameDefinitionSummary; GameDefinitionDetailsViewModel gamingGroupGameDefinitionViewModel; try { gameDefinitionSummary = gameDefinitionRetriever.GetGameDefinitionDetails(id.Value, NUMBER_OF_RECENT_GAMES_TO_SHOW); gamingGroupGameDefinitionViewModel = gameDefinitionTransformation.Build(gameDefinitionSummary, currentUser); } catch (KeyNotFoundException) { return(new HttpNotFoundResult()); } catch (UnauthorizedAccessException) { return(new HttpUnauthorizedResult()); } gamingGroupGameDefinitionViewModel.PlayedGamesPanelTitle = string.Format("Last {0} Played Games", gamingGroupGameDefinitionViewModel.PlayedGames.Count); return(View(MVC.GameDefinition.Views.Details, gamingGroupGameDefinitionViewModel)); }