示例#1
0
        public async Task <IEnumerable <MessageViewModel> > SharePost(SharePostRequest request)
        {
            var currentUser            = Feature.CurrentUser(httpContextAccessor, userRepository);
            var addConversationRequest = new AddConversationRequest();

            addConversationRequest.Participants.AddRange(
                new List <ConversationMember>()
            {
                new ConversationMember()
                {
                    MemberId = request.UserId
                }
            });

            var conversation = await conversationService.AddConversation(addConversationRequest);

            var addMessageRequest = new AddMessageRequest()
            {
                PostId         = request.PostId,
                MessageType    = MessageBaseType.PostThumbnail,
                ConversationId = conversation.OId
            };
            await messageService.AddMessage(addMessageRequest);

            var messageByConversationRequest = new GetMessageByConversationIdRequest()
            {
                ConversationId = conversation.OId,
                Skip           = request.Skip,
                Count          = request.Count
            };

            var result = await messageService.GetMessageByConversationId(messageByConversationRequest);

            return(result);
        }
示例#2
0
        public async Task <IActionResult> SharePost(SharePostRequest request)
        {
            var data = await postService.SharePost(request);

            return(Ok(new ApiOkResponse(data)));
        }