示例#1
0
        public List <Room> UpdatePlayer(IEnumerable <Room> data, StringBuilder TempRoomId)
        {
            var _list   = _repo.UpdatePlayer(data);
            var newList = new List <Room>();
            int count   = 0;

            for (int i = 0; i < _list.Count; i++)
            {
                if (_list[i].Player1 != null)
                {
                    count++;
                }
                if (_list[i].Player2 != null)
                {
                    count++;
                }
                if (_list[i].Player3 != null)
                {
                    count++;
                }
                if (_list[i].Player4 != null)
                {
                    count++;
                }
                if (_list[i].Player5 != null)
                {
                    count++;
                }
                if (_list[i].Player6 != null)
                {
                    count++;
                }
                if (_list[i].Player7 != null)
                {
                    count++;
                }
                if (_list[i].Player8 != null)
                {
                    count++;
                }
                if (_list[i].Player9 != null)
                {
                    count++;
                }
                if (_list[i].Player10 != null)
                {
                    count++;
                }
                newList.Add(new Room {
                    RoomId = _list[i].RoomId, Player1 = _list[i].Player1, Player2 = _list[i].Player2, Player3 = _list[i].Player3, Player4 = _list[i].Player4, Player5 = _list[i].Player5, Player6 = _list[i].Player6, Player7 = _list[i].Player7, Player8 = _list[i].Player8, Player9 = _list[i].Player9, Player10 = _list[i].Player10, TotalPlayers = count, TempRoomID = TempRoomId.ToString()
                });
            }

            return(newList);
        }