示例#1
0
        public async Task <Response> CreateResponseAsync()
        {
            var conversations = await conversationsService.GetUsersConversationsAsync(
                clientConnection.UserId.Value, request.NavigationConversationId, request.NavigationConversationType, request.RequestId).ConfigureAwait(false);

            return(new ConversationsResponse(request.RequestId, conversations.Take(CONVERSATIONS_LIMIT)));
        }
示例#2
0
        public async void ConversationMutedUpdateConversations(long conversationId, ConversationType conversationType, long userId)
        {
            try
            {
                var userConversations = await GetUserConversationsAsync(userId, conversationType).ConfigureAwait(false);

                if (userConversations != null)
                {
                    var conversation = userConversations.FirstOrDefault(conv => conv.ConversationId == conversationId);
                    if (conversation == null)
                    {
                        userConversations = await conversationsService.GetUsersConversationsAsync(userId, conversationId, conversationType, 0).ConfigureAwait(false);

                        conversation = userConversations.FirstOrDefault(conv => conv.ConversationId == conversationId);
                    }
                    if (conversation != null)
                    {
                        conversation.IsMuted = !conversation.IsMuted;
                        UpdateUserConversations(userId, userConversations);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.WriteLog(ex);
            }
        }
        public async Task <List <ConversationPreviewVm> > GetConversations([FromForm] GetConversationsModel model)
        {
            var conversations = await _conversationsService.GetUsersConversationsAsync(
                model.UserId,
                model.ConversationId,
                model.ConversationType,
                RandomExtensions.NextInt64())
                                .ConfigureAwait(false);

            return(conversations);
        }