Exemplo n.º 1
0
        public List <GamePlay> GetRole(IEnumerable <GamePlay> data)
        {
            var _o      = 0;
            var _list   = _repo.GetRoles();
            var players = _repo.RoomGetPlayers(data.ToList());


            var random = new Random();

            for (var i = 0; i < _list.Count; i++)
            {
                var index = random.Next(0, _list.Count - 1);
                if (index == i)
                {
                    continue;
                }
                var temp = _list[i];
                _list[i]     = _list[index];
                _list[index] = temp;
            }
            ;

            foreach (var d in players)
            {
                d.Name         = _list[_o].Name;
                d.OccupationId = _list[_o].Id;
                d.ImgUrl       = _list[_o].ImgUrl;
                d.IsGood       = _list[_o].IsGood;
                d.Description  = _list[_o].Description;
                _o++;
            }

            _repo.PushGetRoles(players);

            return(players);
        }