public ActionResult Index(ScoringSummaryViewModel vm) { if (vm.EventCommand.Contains("breakdown")) { var round = vm.EventCommand.Substring(vm.EventCommand.Length - 1); var viewModel = new PlayerScoringViewModel { SelectedPlayer = Convert.ToInt32(vm.EventArgument), SelectedRound = round, PlayerSelectionVisible = false }; viewModel.GetPlayerScoring(); return(RedirectToAction("PlayerScoring", "Home", new { SelectedPlayer = Convert.ToInt32(vm.EventArgument), SelectedRound = Convert.ToInt32(round) })); } vm.GetGamesByUser(); vm.GetTeamDetailsByGame(); var team = vm.TeamSummariesList.SelectMany(r => r) .FirstOrDefault(p => p.UserTeamID == Convert.ToInt32(vm.EventArgument)); vm.GetFilteredTeamDetails(team.UserTeamID, team.UserTeamName); ViewBag.ScoreTotal = vm.PlayerScoringSummaries.Sum(r => r.PlayerTotal); //ViewBag.TieBreakerScoreTotal = vm.TieBreakerScoringSummaries.Sum(r => r.PlayerTotal); return(View(vm)); }
public ActionResult GetScoringEvents(string playerId, string roundId) { var model = new PlayerScoringViewModel { SelectedPlayer = Convert.ToInt32(playerId), SelectedRound = roundId }; model.GetPlayerScoring(); return(Json(model.ScoringEvents)); }
public ActionResult PlayerScoring(PlayerScoringViewModel viewModel) { if (viewModel.EventCommand == "back") { return(RedirectToAction("Index", "Home")); } if (viewModel.EventCommand == "cancel") { return(View(new PlayerScoringViewModel())); } viewModel.GetPlayerScoring(); return(View(viewModel)); }
public ActionResult PlayerScoring(int?SelectedPlayer, int?SelectedRound) { var vm = new PlayerScoringViewModel(); if ((SelectedPlayer != null) && (SelectedRound != null)) { vm.SelectedPlayer = SelectedPlayer.Value; vm.SelectedRound = SelectedRound.Value.ToString(); vm.GetPlayerScoring(); } return(View(vm)); }