public static void PublishForUser <T>( this NotificationService ns, string description, T entity, string summary, NotificationCategory category, params NotificationAction[] actions) where T : IDomainEntity { ns.Publish(new Notification( description, typeof(T).FullName, entity.Key.ToString(), NotificationRecipientType.Role.Value, "User", summary, category.Id, actions)); }
public static async Task PublishForAllUsers <T>( this NotificationsDbContext ns, string description, T entity, int userId, string summary, NotificationCategory category) where T : DomainEntity { var notification = new Notification( new EntityReference(NotificationRecipientType.UserId.Value, userId.ToString()), new EntityReference(typeof(T).FullName, entity.Key.ToString()), summary, description, category.Id); ns.Notifications.Add(notification); await ns.SaveChangesAsync(); }