示例#1
0
        public async Task <ICollection <Player> > GetFriendsList(string username)
        {
            ICollection <Player> friendList = new List <Player>();

            ICollection <PlayerFriend> friends = await _friendListRepository.GetFriendsList(username);

            foreach (PlayerFriend f in friends)
            {
                string friendUsername;
                if (f.friendId != username)
                {
                    friendUsername = f.friendId;
                }
                else
                {
                    friendUsername = f.playerId;
                }
                Player friend = await _playerRepository.GetByUsername(friendUsername);

                friendList.Add(friend);
            }
            return(friendList);
        }