public BetsViewModel GetMyBattleBets(long battleId, long? userId) { var betsViewModel = new BetsViewModel(); betsViewModel.Title = Bets.MyBets; betsViewModel.NoBetsMessage = Bets.YouHaveMadeNoBetsInThisBattle; if (!userId.HasValue) return betsViewModel; var myBattleBets = GetBetsQuery(BetSpecifications.BattleIdAndUserIdAreEqualTo(battleId, userId.Value)).ToList(); betsViewModel.Bets = GetBetViewModels(myBattleBets, true, false, false); return betsViewModel; }
public BetsViewModel GetUserBets(long userId, long? currentUserId) { var betsViewModel = new BetsViewModel(); if (userId == currentUserId) { betsViewModel.Title = Bets.MyBets; betsViewModel.NoBetsMessage = Bets.YouHaveMadeNoBets; var myBets = GetBetsQuery(BetSpecifications.UserIdIsEqualTo(userId)).Include(b => b.Battle).ToList(); betsViewModel.Bets = GetBetViewModels(myBets, true, true, false); } else { betsViewModel.Title = Bets.UserBets; betsViewModel.NoBetsMessage = Bets.UserHasMadeNoBets; var userBets = GetBetsQuery(BetSpecifications.UserIdIsEqualTo(userId)).Include(b => b.Battle).ToList(); betsViewModel.Bets = GetBetViewModels(userBets, false, true, false); } return betsViewModel; }
public BetsViewModel GetTeamBets(long teamId) { var betsViewModel = new BetsViewModel(); betsViewModel.Title = Bets.TeamBets; betsViewModel.NoBetsMessage = Bets.TeamHasMadeNoBets; var teamBets = GetBetsQuery(BetSpecifications.TeamIdIsEqualTo(teamId)).Include(b => b.User).ToList(); betsViewModel.Bets = GetBetViewModels(teamBets, false, false, true); return betsViewModel; }