public void GetPlayerStocks(int gameId, int playerId) { GameLogicManager gameLogic = new GameLogicManager(); lock (_syncRoot) { var game = EntityStateManager.CurrentGames.FirstOrDefault(x => x.GameId == gameId); var player = game.Players.FirstOrDefault(x => x.PlayerId == playerId); var playerStocks = player.PlayerStocks.ToList(); foreach (var temp in playerStocks) { temp.CurrentPrice = gameLogic.GetStockValue(gameId, temp.SectorId, temp.StockId); temp.IsIncreased = (temp.CurrentPrice > temp.BoughtPrice) ? true : false; temp.Percentage = ((temp.CurrentPrice - temp.BoughtPrice) / temp.BoughtPrice) * 100; temp.Profit = (temp.CurrentPrice * temp.Quantity) - (temp.BoughtPrice * temp.Quantity); } Clients.Client(player.ConnectionId).loadPlayerStocksList(playerStocks); } }