Example #1
0
        public async Task <ChatMessageResult> CreateAsync(Guid chatRoomId, Guid profileId, [FromBody] MessageDto messageDto)
        {
            var chatRoom = await _chatRoomRepository.GetAsync(chatRoomId);

            if (chatRoom == null)
            {
                messageDto.chatRoomId = chatRoomId;
                return(await _chatMessageWriteCommand.CreateForEmptyRoomAsync(profileId, messageDto));
            }
            return(await _chatMessageWriteCommand.CreateAsync(profileId, messageDto));
        }