Ejemplo n.º 1
0
        // 我的中奖查询
        // GET: /Casino/Bet

        public ActionResult MyBet(Criteria criteria)
        {
            var model = new MyBetDto();

            var query = _repo.Query <BetView>(criteria, x => x.UserID == AcnID)
                        .Many <BetView, BetDetail, int>(t => t.ID);

            var mapper = BetDto.ConfigMapper().CreateMapper();

            var list = mapper.Map <IEnumerable <BetDto> >(query.AsEnumerable());

            model.Criteria = criteria;
            model.Data     = list;

            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult Detail(Guid id)
        {
            var model = new DetailDto {
                Match = MatchDto.Single(id)
            };

            var query = _repo.Query <BetView>(x => x.CasinoItem.MatchGuid == id)
                        .Many <BetView, BetDetail, int>(t => t.ID);

            var mapper = BetDto.ConfigMapper().CreateMapper();

            var list = mapper.Map <IEnumerable <BetDto> >(query.AsEnumerable());

            model.Bets = list;

            return(View(model));
        }
Ejemplo n.º 3
0
        // 我要投注
        // GET: /Casino/GameBet

        public ActionResult GameBet(Guid id)
        {
            var model = new GameBetDto();

            var gambler = _repo.Query <Gambler>(x => x.UserID == AcnID).FirstOrDefault();

            model.MyCash = gambler?.Cash ?? 0f;

            model.Match = MatchDto.Single(id);

            // model.MyBets
            var betsQuery = _repo.Query <BetView>(x =>
                                                  x.UserID == AcnID && x.CasinoItem.MatchGuid == id)
                            .Many <BetView, BetDetail, int>(t => t.ID);

            var mapper = BetDto.ConfigMapper().CreateMapper();

            var bList = mapper.Map <IEnumerable <BetDto> >(betsQuery.AsEnumerable());

            model.MyBets = bList;

            // model.HistoryMatches
            var match = _repo.Single <Match>(id);

            var matchesQuery = _repo.Query <MatchView>(x => x.ResultHome.HasValue && x.ResultAway.HasValue)
                               .FindAll(x => x.Home.ID.Equals(match.Home) && x.Away.ID.Equals(match.Away) ||
                                        x.Home.ID.Equals(match.Away) && x.Away.ID.Equals(match.Home));

            mapper = MatchDto.ConfigMapper().CreateMapper();

            var mlist = mapper.Map <IEnumerable <MatchDto> >(matchesQuery.AsEnumerable());

            model.HistoryMatches = mlist;

            return(View(model));
        }