public virtual async Task DeleteAsync(long id)
 {
     await NotificationStore
     .DeleteUserNotificationAsync(
         CurrentTenant.Id,
         CurrentUser.GetId(),
         id);
 }
        public virtual async Task DispatcheAsync(NotificationInfo notification)
        {
            var subscribes = await NotificationStore.GetSubscriptionsAsync(notification.TenantId, notification.Name);

            foreach (var subscribe in subscribes)
            {
                await NotificationStore.InsertUserNotificationAsync(notification, subscribe.UserId);
            }

            var subscribeUsers = subscribes.Select(s => s.UserId);

            await NotifyAsync(notification, subscribeUsers);
        }
        public virtual async Task <PagedResultDto <NotificationInfo> > GetListAsync(UserNotificationGetByPagedDto input)
        {
            var notificationCount = await NotificationStore
                                    .GetUserNotificationsCountAsync(
                CurrentTenant.Id,
                CurrentUser.GetId(),
                input.Filter,
                input.ReadState);

            var notifications = await NotificationStore
                                .GetUserNotificationsAsync(
                CurrentTenant.Id, CurrentUser.GetId(),
                input.Filter, input.Sorting, input.Reverse,
                input.ReadState, input.SkipCount, input.MaxResultCount);

            return(new PagedResultDto <NotificationInfo>(notificationCount, notifications));
        }
 public virtual async Task <NotificationInfo> GetAsync(long id)
 {
     return(await NotificationStore
            .GetNotificationOrNullAsync(CurrentTenant.Id, id));
 }