Beispiel #1
0
        public async Task <IEnumerable <ParticipantResponseViewModel> > ParticipantResponsesAsync()
        {
            var auth0Id = _helper.GetCurrentUserProfile(User);

            var chatMember = _profileRepository.GetChatMemberslist(auth0Id);

            List <ChatParticipantViewModel> chatParticipants = new List <ChatParticipantViewModel> {
            };

            if (chatMember.Result != null)
            {
                foreach (var profile in chatMember.Result)
                {
                    chatParticipants.Add(new ChatParticipantViewModel()
                    {
                        ParticipantType = ChatParticipantTypeEnum.User,
                        Id          = profile.Auth0Id,
                        DisplayName = profile.Name,
                        Avatar      = ""
                    });
                }
            }

            List <ParticipantResponseViewModel> participantResponses = new List <ParticipantResponseViewModel> {
            };

            foreach (var friend in chatParticipants)
            {
                participantResponses.Add(new ParticipantResponseViewModel()
                {
                    Participant = friend,
                    Metadata    = new ParticipantMetadataViewModel {
                        TotalUnreadMessages = 123
                    }                                                                               // TODO: set number of unread messages.
                });
            }

            return(participantResponses);
        }