示例#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();
            }
        }