예제 #1
0
파일: Data.cs 프로젝트: AP-93/Discord-Bot
        public static async Task SaveChanges(int _ID, int _matchesPlayed, string _FortniteName, int _kills, int _wins)
        {
            using (var db = new SqliteDbContext())
            {
                if (db.Players.Where(x => x.ID == _ID).Count() < 1)
                {
                    db.Players.Add(new Players
                    {
                        ID            = _ID,
                        matchesPlayed = _matchesPlayed
                    });
                }
                else
                {
                    Players current = db.Players.Where(x => x.ID == _ID).FirstOrDefault();

                    current.matchesPlayed = _matchesPlayed;
                    current.kills         = _kills;
                    current.wins          = _wins;

                    if (current.FortniteName != _FortniteName)
                    {
                        current.FortniteName = _FortniteName;
                    }
                    db.Players.Update(current);
                }
                await db.SaveChangesAsync();
            }
        }
예제 #2
0
파일: Data.cs 프로젝트: AP-93/Discord-Bot
        public static List <Players> GetData()
        {
            List <Players> plyrList = new List <Players>();

            using (var db = new SqliteDbContext())
            {
                plyrList = (from p in db.Players select p).ToList();
                return(plyrList);
            }
        }
예제 #3
0
파일: Data.cs 프로젝트: AP-93/Discord-Bot
        public static async Task SaveName(int _ID, string name)
        {
            using (var db = new SqliteDbContext())
            {
                Players current = db.Players.Where(x => x.ID == _ID).FirstOrDefault();
                current.FortniteName = name;
                db.Players.Update(current);

                await db.SaveChangesAsync();
            }
        }
예제 #4
0
파일: Data.cs 프로젝트: AP-93/Discord-Bot
        public static async Task SaveMatchId(int _ID, int _matchID)
        {
            using (var db = new SqliteDbContext())
            {
                Players current = db.Players.Where(x => x.ID == _ID).FirstOrDefault();
                current.lastMatchId = _matchID;
                db.Players.Update(current);

                await db.SaveChangesAsync();
            }
        }