public void MessageReadStateChanged(ChatUser mentionedUser, ChatMessage message, Notification notification)
 {
     foreach (var client in mentionedUser.ConnectedClients)
     {
         HubContext.Clients.Client(client.Id).messageReadStateChanged(message.Id, notification.Read);
     }
 }
        public void AddNotification(ChatUser mentionedUser, ChatMessage message, ChatRoom room, bool markAsRead)
        {
            // We need to use the key here since messages might be a new entity
            var notification = new Notification
            {
                User = mentionedUser,
                Message = message,
                Read = markAsRead,
                Room = room
            };

            _repository.Add(notification);
        }
 public void Add(Notification notification)
 {
     _notifications.Add(notification);
 }
 public void Remove(Notification notification)
 {
     _notifications.Remove(notification);
 }
 public void Remove(Notification notification)
 {
     _db.Notifications.Remove(notification);
     _db.SaveChanges();
 }
Exemple #6
0
        public Notification AddNotification(ChatUser mentionedUser, ChatMessage message, ChatRoom room, bool markAsRead)
        {
            var notification = _repository.GetNotificationByMessage(message, mentionedUser);

            if (notification != null)
            {
                notification.Read = markAsRead;

                return notification;
            }

            // We need to use the key here since messages might be a new entity
            notification = new Notification
            {
                User = mentionedUser,
                Message = message,
                Read = markAsRead,
                Room = room
            };

            _repository.Add(notification);

            return notification;
        }
Exemple #7
0
        public void AddNotification(ChatUser mentionedUser, ChatMessage message)
        {
            // We need to use the key here since messages might be a new entity
            var notification = new Notification
            {
                User = mentionedUser,
                Message = message
            };

            _repository.Add(notification);
        }
        public void SendAsync(Notification notification)
        {
            if (notification.Read) return;

            SendAsync(notification.User, notification.Message);
        }