public async Task <AllMessagesDto> GetMessageByChatAsync(GetChatMessagesRequest request) { var chatContent = await this._unit.ChatRepository.GetChatContentAsync(request.Id); if (chatContent == null) { throw new ChatNotExistException("Given chat not exist!!", 400); } var result = new AllMessagesDto() { Users = _map.Map <List <GetUserDto> >(new List <User>() { chatContent.FirstUser, chatContent.SecondUser }), Messages = _map.Map <List <GetMessageDto> >(chatContent.Messages.OrderBy(m => m.TimeCreated)) }; return(result); }
public async Task <AllMessagesDto> GetChatMessages([FromQuery] GetChatMessagesRequest request) { var responce = await this._messageService.GetMessageByChatAsync(request); return(responce); }
public IActionResult GetAllChatMessages(GetChatMessagesRequest command) { var messages = _chatMessageService.GetAllByChatId(command.ChatId); return(Json(messages)); }