public void Delete() { using var dbContext = new MapleDbContext(); var item = dbContext.Memos.Find(Id); if (item != null) { dbContext.Remove(item); dbContext.SaveChanges(); } }
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(); }
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(); }