Пример #1
0
        public async Task <IActionResult> GetAllChatUsers()
        {
            var foundChatUsers = await _chatUserRepository.GetAllAsync(a => a.Deactivate == false);

            var onlineUsers = new List <OnlineUser>();

            if (foundChatUsers != null)
            {
                foreach (var chatUser in foundChatUsers)
                {
                    var onlineUser = new OnlineUser
                    {
                        UserName = chatUser.UserName,
                        FullName = chatUser.FullName,
                        Avatar   = chatUser.Avatar,
                        IsOnline = false
                    };
                    onlineUser.Load();
                    onlineUsers.Add(onlineUser);
                }
            }

            return(Ok(onlineUsers));
        }