Base solution for your next web application
Open Closed

Proper way to Subscribe Notification? #2788


User avatar
0
jackwang created

Hi, I've read this document [http://www.aspnetboilerplate.com/Pages/Documents/Notification-System#subscribe-to-notifications]). But I still don't know where to put subscription code into.

Let's say I want to notify every 'FailedLoginAttempt' to Admin User, and I've written a service to subscribe admin user to it.
Where should I inject this service?

And I've also noticed once subscribed, the subscriptions are saved into database. So I'm guessing it should be subscribed in the creation moment of admin user. Any advice is appreciated.


2 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Subscription can be done in two ways.

    1. If you want to force user to subscribe, you can do in in an app service where you create the user.
    2. You can make a sucbscription page, users can select which notifications to subscribe. In this way, create a app service for example NotificationAppService and add a method to subscribe current user to selected notifications.

    There might be some other cases according to your bussiness logic.

    Thanks.

  • User Avatar
    0
    jackwang created

    <cite>ismcagdas: </cite> Subscription can be done in two ways.

    I've learned that option 2 is Module Zero's approach. Option 1 is what I'm looking for.

    Thanks for your help.