Esempio n. 1
0
 public async Task AddChatMessage(MessageChatDto message)
 {
     DateTime dateTime = DateTime.Now;
     await _messageChatRepository.AddMessageChat(new MessageChat
     {
         MessageText = message.MessageText,
         UserId      = message.UserId,
         ChatId      = message.ChatId,
         MessageDate = dateTime,
         IsSeen      = false
     });
 }
Esempio n. 2
0
        public async Task SendMessage(MessageChatDto messageChatDto)
        {
            await _addMessageChatCommandHandler.Handler(messageChatDto);

            UserDto userDto = await _userQuery.GetUserDtoByUserId(messageChatDto.UserId);

            string chatString = "ChatId" + messageChatDto.ChatId;

            await Clients.All.SendAsync(chatString, new MessageChatDto
            {
                UserId      = messageChatDto.UserId,
                UserName    = userDto.Name,
                MessageText = messageChatDto.MessageText,
                ChatId      = messageChatDto.ChatId,
                IsSeen      = false
            });
        }
        public async Task Handler(MessageChatDto message)
        {
            await _addMessageChatBusiness.AddChatMessage(message);

            await _messageChatRepository.UnitOfWork.Save();
        }
Esempio n. 4
0
 public async Task AddMessageChat([FromBody] MessageChatDto messageChatDto)
 {
     await _addMessageChatCommandHandler.Handler(messageChatDto);
 }