Ejemplo n.º 1
0
 public LadderWeek LadderWeek(int weekId)
 {
     using (var db = new LadderDbContext())
     {
         return(db.LadderWeeks.Find(weekId));
     }
 }
Ejemplo n.º 2
0
 public Match GetMatchById(int id)
 {
     using (var db = new LadderDbContext())
     {
         return(db.Matches.Find(id));
     }
 }
Ejemplo n.º 3
0
 public LadderWeek CurrentWeek()
 {
     using (var db = new LadderDbContext())
     {
         return(db.LadderWeeks.Where(c => c.IsCurrent).First());
     }
 }
Ejemplo n.º 4
0
 public int GetPlayerStanding(int weekId, int playerId)
 {
     using (var db = new LadderDbContext())
     {
         return((from s in db.Standings
                 where s.LadderWeekId == weekId && s.PlayerId == playerId
                 select s.Position).First());
     }
 }
Ejemplo n.º 5
0
        public List <LadderWeek> LadderWeeks()
        {
            using (var db = new LadderDbContext())
            {
                var c = from LadderWeek s in db.LadderWeeks.Include(l => l.Standings)
                        select s;

                return(c.ToList());
            }
        }
Ejemplo n.º 6
0
 public List <Standing> CurrentStandings()
 {
     using (var db = new LadderDbContext())
     {
         var c = from Standing s in db.Standings.Include(l => l.Player)
                 where s.LadderWeek.IsCurrent
                 orderby s.Position
                 select s;
         return(c.ToList());
     }
 }
Ejemplo n.º 7
0
 public Player Player(int playerId)
 {
     using (var db = new LadderDbContext())
     {
         db.Configuration.LazyLoadingEnabled = false;
         var c = from Player s in db.Players.Include("Standings").Include("Standings.LadderWeek")
                 where s.Id == playerId
                 select s;
         return(c.First());
     }
 }
Ejemplo n.º 8
0
 public List <Match> CurrentMatches()
 {
     using (var db = new LadderDbContext())
     {
         var c = from Match s in db.Matches.Include(w => w.Winner).Include(l => l.Looser)
                 where s.LadderWeek.IsCurrent
                 orderby s.DateOfMatch
                 select s;
         return(c.ToList());
     }
 }
Ejemplo n.º 9
0
 public List <Match> PlayerMatches(int playerId)
 {
     using (var db = new LadderDbContext())
     {
         var c = from Match s in db.Matches.Include(w => w.Winner).Include(l => l.Looser).Include(t => t.LadderWeek)
                 where s.LooserId == playerId || s.WinnerId == playerId
                 orderby s.DateOfMatch
                 select s;
         return(c.ToList());
     }
 }
Ejemplo n.º 10
0
 public IEnumerable <Match> GetAllMatches(params Expression <Func <Match, object> >[] includeProperties)
 {
     using (var db = new LadderDbContext())
     {
         IQueryable <Match> query = db.Matches;
         foreach (var includeProperty in includeProperties)
         {
             query = query.Include(includeProperty);
         }
         return(query.ToList());
     }
 }