Exemplo n.º 1
0
 public Task SendNotification(NotificationLevelType type, Guid userId, string header, string message)
 {
     if (_hubNotificationProxy != null)
     {
         return(_hubNotificationProxy.Invoke("OnNotification", type.ToString(), userId.ToString(), header, message));
     }
     return(Task.FromResult(0));
 }
Exemplo n.º 2
0
        //[AuthorizeLocal]
        public async Task OnNotification(NotificationLevelType type, string user, string header, string notification)
        {
            var notificationModel = new NotificationModel
            {
                Header       = header,
                Notification = notification,
                Type         = type
            };

            if (string.IsNullOrEmpty(user))
            {
                await Clients.All.SendNotification(notificationModel);

                return;
            }
            await Clients.User(user).SendNotification(notificationModel);
        }
 public void AddNotification(NotificationLevelType level, string message)
 {
     Notifications.Add(new Notification {
         Level = level, Message = message
     });
 }