Exemple #1
0
 public Task SendNotificationMessageAsync(Guid userId, BaseNotificationMessage message)
 {
     return(_notificationHubContext
            .Clients
            .User(userId.ToString())
            .SendAsync(NotificationMethodName, message));
 }
Exemple #2
0
        public Task SendNotificationMessageAsync(ClaimsPrincipal user, BaseNotificationMessage message)
        {
            var userId = user.FindFirst(ClaimTypes.NameIdentifier);

            if (userId == null || string.IsNullOrEmpty(userId.Value))
            {
                throw new UserNotLoggedInException();
            }

            return(SendNotificationMessageAsync(Guid.Parse(userId.Value), message));
        }