public static void AddToastify(this IServiceCollection services, Action <ToastifyConfig> toastifyConfiguration)
        {
            var config = new ToastifyConfig();

            toastifyConfiguration(config);
            var toastify = new ToastifyEntity(config.DurationInSeconds, config.Gravity, config.Position);

            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }
            services.AddFrameworkServices();
            //Add TempDataWrapper for accessing and adding values to tempdata.
            services.AddSingleton <ITempDataService, TempDataService>();
            services.AddSingleton <IToastNotificationContainer <ToastifyNotification>, TempDataToastNotificationContainer <ToastifyNotification> >();
            //Add the ToastNotification implementation
            services.AddScoped <IToastifyService, ToastifyService>();
            services.AddSingleton(toastify);
        }
Exemple #2
0
 public ToastifyViewComponent(IToastifyService service, ToastifyEntity options)
 {
     this._service = service;
     _options      = options;
 }