Beispiel #1
0
        public async Task Create(ENotificationEvent @event, IEnumerable <long> recipientIds, string page, object routeData, string?fragment = null, string?body = null)
        {
            var notification = new Notification
            {
                Body  = body,
                Event = @event,
                Url   = _urlHelper.Page(page, routeData) + (fragment is null ? null : "#" + fragment)
            };
            await _context.Notifications.AddAsync(notification);

            var notificationRecipients = recipientIds
                                         .Select(u => new NotificationRecipients {
                RecipientId = u, Notification = notification
            });

            await _context.NotificationRecipients.AddRangeAsync(notificationRecipients);

            await _context.SaveChangesAsync();
        }
Beispiel #2
0
 private static string Message(ENotificationEvent @event) => @event switch
 {
Beispiel #3
0
 public static string GetMessage(this ENotificationEvent @event) => @event switch
 {