public async Task <IActionResult> DelTeam(int Id) { var gameId = _context.SubGames.Single(g => g.ID == Id).GameID; var delSubgame = _context.SubGames.Single(g => g.ID == Id); var updateSubgames = _context.SubGames.Where(t => t.GameID == delSubgame.GameID && t.Round > delSubgame.Round); foreach (var us in updateSubgames) { us.Round--; } //_context.Update(updateSubgames); //필요업음 _context.Remove(delSubgame); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index), new { Id = gameId, game = delSubgame.Round > 1? --delSubgame.Round : 1 })); }