public async Task <IActionResult> Get( [FromRoute] Guid chatId, [FromQuery][DefaultValue("1")] int?page, [DefaultValue("25")] int?size, CancellationToken cancellationToken) { ChatDetails chat = await _chatsData.GetByIdAsync(chatId, cancellationToken); if (chat == null) { return(this.BadRequest(new ProblemDetails() { Detail = $"Chat with id {chatId} not found." })); } int pageValue = page ?? 1; int sizeValue = size ?? 25; PagedList <ChatMessage> messages = await _messagesData .GetMessagesAsync( chatId, pageValue, sizeValue, cancellationToken); return(this.Ok(messages)); }
public async Task <IActionResult> Get(Guid chatId, CancellationToken cancellationToken) { ChatDetails chat = await _chatsData.GetByIdAsync(chatId, cancellationToken); return(this.Ok(chat)); }