Exemple #1
0
        public ApiResponse GetUserList()
        {
            _userDataProvider = new UserDataProvider();
            var response = _userDataProvider.GetUserList();

            if (response.IsSuccess)
            {
                var userList    = response.Data as List <User>;
                var onlineUsers = ChatHub.GetAllActiveConnections();
                foreach (var item in userList)
                {
                    var a = onlineUsers.FirstOrDefault(x => x.UserId == item.UserId.ToString());
                    item.IsOnline = a != null;
                }
                response.Data = userList;
            }
            return(response);
        }
Exemple #2
0
 public async Task <IEnumerable <ChatConnection> > GetOnlineUsers()
 {
     return(await _chatHub.GetAllActiveConnections());
 }