예제 #1
0
        public async Task <IActionResult> GetPastBetsByUser(int userId, [FromQuery] BetParams betParams)
        {
            var bets = await betRepository.GetPastBetsByUser(userId, betParams);

            Response.AddPagination(bets.CurrentPage, bets.PageSize, bets.TotalCount, bets.TotalPages);

            return(Ok(bets));
        }
예제 #2
0
        public async Task <PagedList <Bet> > GetPastBetsByUser(int userId, BetParams betParams)
        {
            var bets = dataContext.Bets.Include(b => b.Match).Include(b => b.Match.TeamA).Include(b => b.Match.TeamB).Where(b => b.UserId == userId && b.Match.Date < DateTime.Now).OrderByDescending(b => b.Id);

            return(await PagedList <Bet> .CreateAsync(bets, betParams.PageNumber, betParams.PageSize));
        }