コード例 #1
0
        public JsonResult GetList(MatchCond cond, int page, int rows)
        {
            int total;
            var result = MatchService.Instance.GetMatchListByPage(cond, rows, page, out total);

            return(Json(new
            {
                rows = result.Select(x => new
                {
                    x.Id,
                    x.TeamA,
                    x.TeamB,
                    x.MatchTime,
                    x.Operator,
                    x.Dish,
                    x.Venue,
                    x.MatchState,
                    x.MatchResult,
                    CreateTime = x.CreateTime.ToString(),
                }),
                total
            }, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        public List <MatchDto> GetMatchListByPage(MatchCond cond, int size, int index, out int total)
        {
            var query = matchRepository.Source;

            if (cond.StartDate != null && cond.EndDate != null)
            {
                query = query.Where(x => x.MatchTime >= cond.StartDate.Value && x.MatchTime <= cond.EndDate.Value);
            }
            if (!string.IsNullOrEmpty(cond.TeamA))
            {
                query = query.Where(x => cond.TeamA.Contains(x.TeamA));
            }
            if (!string.IsNullOrEmpty(cond.TeamB))
            {
                query = query.Where(x => cond.TeamB.Contains(x.TeamB));
            }
            if (!string.IsNullOrEmpty(cond.MatchState))
            {
                query = query.Where(x => x.MatchState.ToString() == cond.MatchState);
            }
            query = query.OrderByDescending(x => x.CreateTime);
            return(matchRepository.FindForPaging(size, index, query, out total).ToList().ToListModel <Match, MatchDto>());
        }
コード例 #3
0
        public List <MatchDto> GetMatchList(MatchCond cond)
        {
            int total;

            return(GetMatchListByPage(cond, 1000, 1, out total));
        }