示例#1
0
 public List <GameStatistics> GetAll()
 {
     using (GamingAppDataContext db = new GamingAppDataContext())
     {
         return(db.GameStatistics.ToList());
     }
 }
示例#2
0
 public int InsertGameStatistics(GameStatistics gameStatistics)
 {
     using (GamingAppDataContext db = new GamingAppDataContext())
     {
         db.GameStatistics.Add(gameStatistics);
         var result = db.SaveChanges();
         return(result);
     }
 }
示例#3
0
        public IEnumerable <Ranking> GetTopPlayers()
        {
            using (GamingAppDataContext db = new GamingAppDataContext())
            {
                var response = from p in db.GameStatistics
                               group p.PlayerWinner by p.PlayerWinner into g
                               select new Ranking {
                    PlayerName = g.Key, TotalWins = g.Count()
                };

                return(response.OrderByDescending(x => x.TotalWins).ToList());
            }
        }
示例#4
0
 public UnitOfWork(GamingAppDataContext dbContext)
 {
     _dbContext = dbContext;
 }
 public void Init()
 {
     dbContext     = new GamingAppDataContext();
     _UnitofWork   = new UnitOfWork(dbContext);
     _GamingAppDAC = new GamingAppDAC();
 }
 public BaseRepository(GamingAppDataContext context)
 {
     this.context = context;
     this.dbSet   = context.Set <TEntity>();
 }