Example #1
0
        public async Task SendNotificationsAsync()
        {
            var toNotify = await _emergencyAccessRepository.GetManyToNotifyAsync();

            foreach (var notify in toNotify)
            {
                var ea = notify.ToEmergencyAccess();
                ea.LastNotificationDate = DateTime.UtcNow;
                await _emergencyAccessRepository.ReplaceAsync(ea);

                await _mailService.SendEmergencyAccessRecoveryReminder(ea, notify.GranteeName, notify.GrantorEmail);
            }
        }
        public async Task SendNotificationsAsync()
        {
            var toNotify = await _emergencyAccessRepository.GetManyToNotifyAsync();

            foreach (var notify in toNotify)
            {
                var ea = notify.ToEmergencyAccess();
                ea.LastNotificationDate = DateTime.UtcNow;
                await _emergencyAccessRepository.ReplaceAsync(ea);

                var granteeNameOrEmail = string.IsNullOrWhiteSpace(notify.GranteeName) ? notify.GranteeEmail : notify.GranteeName;

                await _mailService.SendEmergencyAccessRecoveryReminder(ea, granteeNameOrEmail, notify.GrantorEmail);
            }
        }