예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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();
        }
예제 #5
0
 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());
 }
예제 #6
0
 public List <TournamentEntity> GetAllWithAllTables()
 {
     using var DBContext = new B3DTContext();
     return(DBContext.Tournaments.Include(I => I.Stadium).Include(I => I.GameServer).ToList());
 }
예제 #7
0
 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());
 }
예제 #8
0
 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());
 }
예제 #9
0
 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));
 }
예제 #11
0
 public List <TeamEntity> GetOwnedTeamsByUserId(int id)
 {
     using var context = new B3DTContext();
     return(context.Teams.Where(I => I.AppUserId == id).ToList());
 }
예제 #12
0
 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());
 }
예제 #13
0
 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());
 }
예제 #14
0
 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());
 }
예제 #15
0
 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();
 }
예제 #19
0
 public int GetRoundIdByTournamentId(int tournamentId)
 {
     using var context = new B3DTContext();
     return(context.TournamentBracketRounds.Where(I => I.TournamentId == tournamentId).FirstOrDefault().Id);
 }
예제 #20
0
 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());
 }
예제 #21
0
 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());
 }