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)); }
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 _commentService.GetCommentsAsync(parameters.ConversationId, pagingOptions, ct); var collection = CollectionWithPaging <CommentResource> .Create( Link.ToCollection( nameof(GetConversationCommentsByIdAsync), new GetConversationByIdParameters { ConversationId = parameters.ConversationId }), conversationComments.Items.ToArray(), conversationComments.TotalSize, pagingOptions); return(Ok(collection)); }