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 }); }
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(); }
public async Task AddMessageChat([FromBody] MessageChatDto messageChatDto) { await _addMessageChatCommandHandler.Handler(messageChatDto); }