public void RemoveFromDb(LudoContext context) { context = new LudoContext(); if (context.Session.Any(s => s.SessionId == this.SessionId)) { context.Session.Remove(this); } context.SaveChanges(); }
public async Task <Session> LoadSessionAsync(LudoContext context) { Session session = null; context = new LudoContext(); session = await context.Session .Include(s => s.Players) .ThenInclude(p => p.GamePieces) .FirstOrDefaultAsync(); context.SaveChanges(); return(session); }