public async Task <IActionResult> ShowTipsByLeagueAndTip(int TipTypeId, int TipId, int LeagueId) { decimal TotalPlayed = await leagueRepository.GetLeagueTotalPlayedByTip(LeagueId, TipId); decimal Wins = await leagueRepository.GetLeagueWinsByTip(LeagueId, TipId); decimal Odds = await leagueRepository.GetLeagueAverageOddsByTip(LeagueId, TipId); decimal Percentage = PercentageCalculator.CalculatePercentage(TotalPlayed, Wins); decimal Roi = PercentageCalculator.CalculateRoi(TotalPlayed, Wins, Odds); LeagueTipDetailedViewModel VM = new LeagueTipDetailedViewModel { Tip = await tipRepository.GetTipByTipId(TipId), League = await leagueRepository.GetLeagueByIdAsync(LeagueId), LeagueTotalPlayed = TotalPlayed, LeagueWins = Wins, LeagueAverageOdds = Odds, LeaguePercentage = Percentage, LeagueRoi = Roi, Predictions = await leagueRepository.GetPredictionsByLeagueAndTip(LeagueId, TipId), ControllerName = "Statistics", TipTypeId = TipTypeId }; ViewData["TipTypeId"] = TipTypeId; return(View("LeagueTipDetailed", VM)); }
public async Task <IActionResult> ShowLeagueStats(int TipTypeId, int LeagueId) { decimal TotalPlayed = await leagueRepository.GetLeagueTotalPlayed(LeagueId, TipTypeId); decimal Wins = await leagueRepository.GetLeagueWins(LeagueId, TipTypeId); decimal Odds = await leagueRepository.GetLeagueAverageOdds(LeagueId, TipTypeId); decimal Percentage = PercentageCalculator.CalculatePercentage(TotalPlayed, Wins); decimal Roi = PercentageCalculator.CalculateRoi(TotalPlayed, Wins, Odds); LeagueViewModel lVM = new LeagueViewModel { LeagueTotalPlayed = TotalPlayed, LeagueWins = Wins, LeaguePercentage = Percentage, LeagueAverageOdds = Odds, LeagueRoi = Roi, League = await leagueRepository.GetLeagueByIdAsync(LeagueId), Predictions = await leagueRepository.GetPredictionsByLeagueAndTipType(LeagueId, TipTypeId), TipStats = await repository.GetTipStatsByLeague(TipTypeId, LeagueId), ControllerName = "Statistics", TipTypeId = TipTypeId }; ViewData["TipTypeId"] = TipTypeId; return(View("League", lVM)); }