public virtual async Task <List <NotificationSubscriptionInfo> > GetUserSubscriptionsAsync( Guid?tenantId, string notificationName, IEnumerable <UserIdentifier> identifiers = null, CancellationToken cancellationToken = default) { using (_currentTenant.Change(tenantId)) { var userSubscriptions = new List <UserSubscribe>(); if (identifiers == null) { userSubscriptions = await _userSubscribeRepository .GetUserSubscribesAsync(notificationName, null, cancellationToken); } else { userSubscriptions = await _userSubscribeRepository .GetUserSubscribesAsync( notificationName, identifiers.Select(ids => ids.UserId), cancellationToken); } return(_objectMapper.Map <List <UserSubscribe>, List <NotificationSubscriptionInfo> >(userSubscriptions)); } }
public virtual async Task <PagedResultDto <NotificationSubscriptionInfo> > GetSubscribedsAsync(SubscriptionsGetByPagedDto subscriptionsGetByPaged) { var userSubscribedCount = await _userSubscribeRepository.GetCountAsync(CurrentUser.GetId()); var userSubscribes = await _userSubscribeRepository .GetUserSubscribesAsync(CurrentUser.GetId(), subscriptionsGetByPaged.Sorting, subscriptionsGetByPaged.SkipCount, subscriptionsGetByPaged.MaxResultCount); return(new PagedResultDto <NotificationSubscriptionInfo>(userSubscribedCount, ObjectMapper.Map <List <UserSubscribe>, List <NotificationSubscriptionInfo> >(userSubscribes))); }