示例#1
0
        public void Delete()
        {
            using var dbContext = new MapleDbContext();
            var item = dbContext.Memos.Find(Id);

            if (item != null)
            {
                dbContext.Remove(item);
                dbContext.SaveChanges();
            }
        }
示例#2
0
        public void Save()
        {
            using var context = new MapleDbContext();
            var existing = context.TeleportRocks.Where(x => x.CharacterId == Parent.Id).ToArray();

            context.TeleportRocks.RemoveRange(existing);
            context.TeleportRocks.AddRange(Maps.Select(x => new TeleportRockEntity
            {
                CharacterId = Parent.Id, MapId = x
            }));
            context.SaveChanges();
        }
示例#3
0
        public void SetOnline(bool isOnline)
        {
            using var context = new MapleDbContext();
            var account = context.Accounts.FirstOrDefault(x => x.Id == Account.Id);

            if (account == null)
            {
                return;
            }

            account.IsOnline = isOnline;
            context.SaveChanges();
        }