예제 #1
0
 public async Task InsertUserNotificationAsync(UserNotificationInfo userNotification)
 {
     await _unitOfWorkManager.PerformAsyncUow(async() =>
     {
         await _userNotificationRepository.InsertAsync(userNotification);
         await _unitOfWorkManager.Current.SaveChangesAsync();
     });
 }
예제 #2
0
        protected virtual async Task <List <UserNotificationInfo> > SaveUserNotifications(long[] userIds, NotificationInfo notificationInfo)
        {
            return(await _unitOfWorkManager.PerformAsyncUow(async() =>
            {
                var userNotifications = new List <UserNotificationInfo>();
                foreach (var userId in userIds)
                {
                    var userNotification = new UserNotificationInfo(_guidGenerator.Create())
                    {
                        UserId = userId,
                        NotificationId = notificationInfo.Id
                    };

                    await _notificationStore.InsertUserNotificationAsync(userNotification);
                    userNotifications.Add(userNotification);
                }
                return userNotifications;
            }));
        }