public async Task ExecuteAsync(NotificationJobParameter parameter) { var notificationModel = await _notificationService.GetNotification(parameter.ScheduleId); var statusResponse = await _notifierService.NotifyAsync(notificationModel); //TODO: Update schedule users statuses //_notificationService.UpdateNotification(statusResponse); }
protected async Task NotifyAsync(INotifierService service, NotifierData data) { try { await service.NotifyAsync(data); } catch (Exception ex) { _logger.Error <NotificationsService>(ex); } }
public async Task ExecuteAsync(NotificationJobParameter parameter) { var notificationModel = await _notificationService.GetNotification(parameter.ScheduleId); var succeededUsers = await _notifierService.NotifyAsync(notificationModel); //TODO: delete converting to int when notifier will return list of integers var succeededUserIds = succeededUsers.Select(s => Convert.ToInt64(s)).ToList(); var failedUsers = notificationModel.UserIds.Except(succeededUserIds); //Update Users statuses _notificationService.SetNotificationStatus(NotificationStatus.Succeeded, notificationModel.ScheduleId, succeededUserIds.ToArray()); _notificationService.SetNotificationStatus(NotificationStatus.Failed, notificationModel.ScheduleId, failedUsers.ToArray()); }