//This method creates a new Ticket and then creates a new Bet with Prediction retrieved from PredictionRepository by Id
        public async Task <Bet> AddBet(string UserId, int PredictionId)
        {
            Prediction p = await predictionRepository.GetPredictionByIdAsync(PredictionId);

            Ticket t = await AddTicket(UserId, p.Odds);

            Bet b = new Bet
            {
                TicketId           = t.TicketId,
                PredictionId       = PredictionId,
                PredictionPosition = 0
            };
            await db.Bets.AddAsync(b);

            await db.SaveChangesAsync();

            return(b);
        }
        public async Task <IActionResult> EditPrediction(int PredictionId)
        {
            Prediction p = await predictionRepository.GetPredictionByIdAsync(PredictionId);

            PredictionViewModel predictionViewModel = new PredictionViewModel()
            {
                PredictionId = p.PredictionId,
                Odds         = p.Odds,
                Chance       = p.Chance,
                MatchId      = p.MatchId,
                TipId        = p.TipId,
                Matches      = await matchRepository.GetMatches(),
                Tips         = await tipRepository.GetTips(),
                Roles        = await accountRepository.GetRoles()
            };

            return(View("Prediction", predictionViewModel));
        }
        public async Task AddTicketItem(int PredictionId)
        {
            Prediction p = await predictionRepository.GetPredictionByIdAsync(PredictionId);

            await betRepository.AddTicketItem(GetUserId(), p);
        }