Exemple #1
0
        public virtual async Task InsertSubscriptionAsync(NotificationSubscriptionInfo subscription)
        {
            using (unitOfWorkManager.Current.SetTenantId(subscription.TenantId))
            {
                await notificationSubscriptionRepository.InsertAsync(subscription);

                await unitOfWorkManager.Current.SaveChangesAsync();
            }
        }
Exemple #2
0
        /// <summary>
        ///     Converts <see cref="UserNotificationInfo" /> to <see cref="UserNotification" />.
        /// </summary>
        public static NotificationSubscription ToNotificationSubscription(
            this NotificationSubscriptionInfo subscriptionInfo)
        {
            var entityType = subscriptionInfo.EntityTypeAssemblyQualifiedName.IsNullOrEmpty()
                ? null
                : Type.GetType(subscriptionInfo.EntityTypeAssemblyQualifiedName);

            return(new NotificationSubscription
            {
                TenantId = subscriptionInfo.TenantId,
                UserId = subscriptionInfo.UserId,
                NotificationName = subscriptionInfo.NotificationName,
                EntityType = entityType,
                EntityTypeName = subscriptionInfo.EntityTypeName,
                EntityId =
                    subscriptionInfo.EntityId.IsNullOrEmpty()
                        ? null
                        : JsonConvert.DeserializeObject(subscriptionInfo.EntityId,
                                                        EntityHelper.GetPrimaryKeyType(entityType)),
                CreationTime = subscriptionInfo.CreationTime
            });
        }
 public Task InsertSubscriptionAsync(NotificationSubscriptionInfo subscription)
 {
     return(Task.FromResult(0));
 }