Ejemplo n.º 1
0
        public async Task <IActionResult> GetConversationByIdAsync(GetConversationByIdParameters parameters, CancellationToken ct)
        {
            if (parameters.ConversationId == Guid.Empty)
            {
                return(NotFound());
            }

            var conversation = await _conversationService.GetConversationAsync(parameters.ConversationId, ct);

            if (conversation == null)
            {
                return(NotFound());
            }

            return(Ok(conversation));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> GetConversationCommentsByIdAsync(
            GetConversationByIdParameters parameters,
            [FromQuery] PagingOptions pagingOptions,
            CancellationToken ct)
        {
            pagingOptions.Offset = pagingOptions?.Offset ?? _defaultPagingOptions.Offset;
            pagingOptions.Limit  = pagingOptions?.Limit ?? _defaultPagingOptions.Limit;

            var conversationComments = await _CustomerService.GetCommentsAsync(parameters.ConversationId, pagingOptions, ct);

            var collection = CollectionWithPaging <CustomerResource> .Create(
                Link.ToCollection(
                    nameof(GetConversationCommentsByIdAsync),
                    new GetConversationByIdParameters {
                ConversationId = parameters.ConversationId
            }),
                conversationComments.Items.ToArray(),
                conversationComments.TotalSize,
                pagingOptions);

            return(Ok(collection));
        }