public List <TeamEntity> GetUserTeamsById(int id) { using var context = new B3DTContext(); var result = context.TeamPlayers.Include(I => I.Team).Where(I => I.AppUserId == id).Select(I => I.Team).ToList(); return(result); }
public void StartById(int id) { using var DBContext = new B3DTContext(); var tournament = DBContext.Tournaments.Where(I => I.Id == id).FirstOrDefault(); tournament.IsStarted = true; Update(tournament); }
public List <PlayedGamesEntity> GetTournamentGamesByUserIdWithAll(int userId, int tournamentId) { using var context = new B3DTContext(); var gameList = context.PlayedGames.Include(I => I.AwayTeam).ThenInclude(I => I.Players).Include(I => I.HomeTeam).Include(I => I.PlayedGamesRound).ThenInclude(I => I.Tournament).Where(I => I.PlayedGamesRound.TournamentId == tournamentId && ((I.HomeTeam != null && I.HomeTeam.AppUserId == userId) || (I.AwayTeam != null && I.AwayTeam.AppUserId == userId))).ToList(); return(gameList); }
public void ConfirmRegisterStatus(TeamEntity team, int tournamentId) { using var context = new B3DTContext(); var data = context.TournamentTeams.Where(I => I.TournamentId == tournamentId && I.TeamId == team.Id).FirstOrDefault(); data.IsConfirmed = true; context.SaveChanges(); }
public TournamentEntity GetTournamentWithAllTablesById(int id) { using var DBContext = new B3DTContext(); return(DBContext.Tournaments.Where(I => I.Id == id).Include(I => I.Stadium).Include(I => I.GameServer).Include(I => I.TournamentTeams).ThenInclude(I => I.Team).FirstOrDefault()); }
public List <TournamentEntity> GetAllWithAllTables() { using var DBContext = new B3DTContext(); return(DBContext.Tournaments.Include(I => I.Stadium).Include(I => I.GameServer).ToList()); }
public List <PlayedGamesEntity> GetPlayedGamesWithAllTablesByTournamentId(int tournamentId) { using var context = new B3DTContext(); return(context.PlayedGames.Include(I => I.AwayTeam).Include(I => I.HomeTeam).Include(I => I.PlayedGamesRound).ThenInclude(I => I.Tournament).Where(I => I.PlayedGamesRound.TournamentId == tournamentId).ToList()); }
public PlayedGamesEntity GetByIdWithTeamTable(int id) { using var context = new B3DTContext(); return(context.PlayedGames.Include(I => I.AwayTeam).Include(I => I.HomeTeam).Where(I => I.Id == id).FirstOrDefault()); }
public List <PlayedGamesEntity> GetAllByRoundId(int roundId) // Todo: its not returning all { using var context = new B3DTContext(); return(context.PlayedGames.Where(I => I.RoundId == roundId).ToList()); }
public EntityTable GetById(int id) { using var context = new B3DTContext(); return(context.Set <EntityTable>().Find(id)); }
public List <TeamEntity> GetOwnedTeamsByUserId(int id) { using var context = new B3DTContext(); return(context.Teams.Where(I => I.AppUserId == id).ToList()); }
public List <TournamentEntity> GetUpcomingTournamentsWithAllTables() { using var DBContext = new B3DTContext(); return(DBContext.Tournaments.Where(I => !I.IsFinished && !I.IsStarted).Include(I => I.Stadium).Include(I => I.GameServer).Include(I => I.TournamentTeams).ToList()); }
public List <ProtestResponseEntity> GetProtestResponsesByProtestIdWithAll(int protestId) { using var context = new B3DTContext(); return(context.ProtestsResponses.Include(I => I.AppUser).Include(I => I.Protest).Where(I => I.ProtestId == protestId).OrderBy(I => I.Date).ToList()); }
public ProtestEntity GetByIdWithAll(int id) { using var context = new B3DTContext(); return(context.Protests.Include(I => I.PlayedGame).ThenInclude(I => I.AwayTeam).Include(I => I.PlayedGame).ThenInclude(I => I.HomeTeam).Include(I => I.AppUser).Where(I => I.Id == id).OrderByDescending(I => I.Date).FirstOrDefault()); }
public List <ProtestEntity> GetAllByUserIdWithAll(int userId) { using var context = new B3DTContext(); return(context.Protests.Include(I => I.PlayedGame).ThenInclude(I => I.AwayTeam).Include(I => I.PlayedGame).ThenInclude(I => I.HomeTeam).Include(I => I.AppUser).Where(I => I.AppUserId == userId).OrderByDescending(I => I.Date).ToList()); }
public List <TeamEntity> GetTournamentConfirmedTeamsByTournamentId(int tournamentId) { using var context = new B3DTContext(); return(context.TournamentTeams.Include(I => I.Team).Where(I => I.TournamentId == tournamentId && I.IsConfirmed).Select(I => I.Team).ToList()); }
public int GetTotalTeamCountByTournamentId(int tournamentId) { using var context = new B3DTContext(); return(context.TournamentTeams.Where(I => I.TournamentId == tournamentId /*&& I.IsConfirmed*/).Count()); }
public void Update(EntityTable table) { using var context = new B3DTContext(); context.Set <EntityTable>().Update(table); context.SaveChanges(); }
public int GetRoundIdByTournamentId(int tournamentId) { using var context = new B3DTContext(); return(context.TournamentBracketRounds.Where(I => I.TournamentId == tournamentId).FirstOrDefault().Id); }
public PlayedGamesEntity GetAllById(int id) { using var context = new B3DTContext(); return(context.PlayedGames.Include(I => I.AwayTeam).Include(I => I.HomeTeam).Include(I => I.PlayedGamesRound).ThenInclude(I => I.Tournament).Where(I => I.Id == id).FirstOrDefault()); }
public TeamEntity GetTeamByInviteCodeWithUserTable(string inviteCode) { using var context = new B3DTContext(); return(context.Teams.Where(I => I.InviteCode == inviteCode).Include(I => I.AppUser).FirstOrDefault()); }
public List <EntityTable> GetAll() { using var context = new B3DTContext(); return(context.Set <EntityTable>().ToList()); }