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(); }
private static string Message(ENotificationEvent @event) => @event switch {
public static string GetMessage(this ENotificationEvent @event) => @event switch {