예제 #1
0
        public NewBetModel UpdateBet(int id, UpdateBetModel bet)
        {
            var betToUpdate = new Bet();

            betToUpdate.BetId       = id;
            betToUpdate.HomeScore   = bet.HomeScore;
            betToUpdate.AwayScore   = bet.AwayScore;
            betToUpdate.CornersMark = bet.CornersMark;
            betToUpdate.CardsMark   = bet.CardsMark;
            betToUpdate.GameId      = bet.GameId;
            betToUpdate.UserId      = userProivider.UserId;
            betValidator.ValidateUpdateBet(betToUpdate);
            betsRepository.UpdateBet(betToUpdate);
            betsRepository.Save();
            Trace.TraceInformation("Updating Bet: {0}", betToUpdate);
            AddLog(ActionType.UPDATE, string.Format("Updating Bet: {0}", betToUpdate));
            return(new NewBetModel(id, bet));
        }
예제 #2
0
        public NewBetModel UpdateBet(int id, UpdateBetModel bet)
        {
            var betToUpdate = new Bet();

            betToUpdate.BetId       = id;
            betToUpdate.HomeScore   = bet.HomeScore;
            betToUpdate.AwayScore   = bet.AwayScore;
            betToUpdate.CornersMark = "X";
            betToUpdate.CardsMark   = "X";
            betToUpdate.GameId      = bet.GameId;
            betToUpdate.UserId      = userProivider.UserId;
            betValidator.ValidateUpdateBet(betToUpdate);
            betsRepository.UpdateBet(betToUpdate);
            betsRepository.Save();
            Trace.TraceInformation("Updating Bet: {0}", betToUpdate);
            AddLog(ActionType.UPDATE, string.Format("Updating Bet: {0}", betToUpdate));
            if (ShouldSendMail())
            {
                MundialitoUser user = userManager.FindById(userProivider.UserId);
                Game           game = gamesRepository.GetGame(bet.GameId);
                SendBetMail(betToUpdate);
            }
            return(new NewBetModel(id, bet));
        }