Ejemplo n.º 1
0
        public async Task MessageSeen(int chatId, int msgId, string currentUserId)
        {
            Chat chat = repository.Chats
                        .FirstOrDefault(c => c.ChatId == chatId);

            if (chat != null)
            {
                ChatMessage msg = chat.Messages
                                  .FirstOrDefault(m => m.Id == msgId);
                repository.AddSeenChat(msg);

                await Clients.All.SendAsync("MsgSeen", chatId, msgId);

                await Clients.All.SendAsync("CheckTotalUnseenHeader",
                                            chat.User1Id, chat.User2Id);

                await Clients.All.SendAsync("HeaderMsgSeen", chatId, currentUserId);
            }
        }