Esempio n. 1
0
        //This method returns dictionary including tips and their stats for League specified

        public async Task <ConcurrentDictionary <Tip, decimal[]> > GetTipStatsByLeague(int TipTypeId, int LeagueId)
        {
            ConcurrentDictionary <Tip, decimal[]> TipStats = new ConcurrentDictionary <Tip, decimal[]>();

            foreach (var item in await GetTipsByLeagueAndTipType(LeagueId, TipTypeId))
            {
                decimal Odds = await tipRepository.GetTipAverageOddsByLeague(item.TipId, LeagueId);

                decimal Total = await tipRepository.GetTipTotalPlayedByLeague(item.TipId, LeagueId);

                decimal Wins = await tipRepository.GetTipWinsByLeague(item.TipId, LeagueId);

                if (Total != 0)
                {
                    TipStats.TryAdd(item, new decimal[] { Odds, Total, Wins });
                }
            }

            return(TipStats);
        }