public async Task <Guid?> HandleAsync(GetNotificationIdByNumber message) { var id = await notificationApplicationRepository.GetIdOrDefault(FormatNotificationNumber(message.NotificationNumber)); if (id != null) { try { await notificationApplicationAuthorization.EnsureAccessAsync(id.Value); } catch (Exception) { return(null); } } return(id); }
public async Task <NotificationInfo> HandleAsync(GetNotificationInfo message) { var id = await notificationApplicationRepository.GetIdOrDefault(message.Number); var importId = await importNotificationRepository.GetIdOrDefault(message.Number); if (!id.HasValue && !importId.HasValue) { return(new NotificationInfo { IsExistingNotification = false }); } if (id.HasValue) { var notificationAssessment = await notificationAssessmentRepository.GetByNotificationId(id.Value); return(new NotificationInfo { IsExistingNotification = true, Id = id.Value, ExportNotificationStatus = notificationAssessment.Status, TradeDirection = TradeDirection.Export }); } else { var notificationAssessment = await importNotificationAssessmentRepository.GetByNotification(importId.Value); return(new NotificationInfo { IsExistingNotification = true, Id = importId.Value, ImportNotificationStatus = notificationAssessment.Status, TradeDirection = TradeDirection.Import }); } }