public async Task <ANotification_Notification> GetNotificationAsync(long notificationId) { using var log = BeginFunction(nameof(NotificationAdminService), nameof(GetNotificationAsync), notificationId); try { await Assert(SecurityPolicy.IsPrivileged).ConfigureAwait(false); var mNotification = await CommunicationMicroService.GetNotificationAsync(notificationId).ConfigureAwait(false); var mUser = mNotification.ParticipantReference != null && TryParseUserId.FromParticipantReference(mNotification.ParticipantReference, out string userId) ? await UserMicroService.GetUserAsync(userId) : null; var result = Create.ANotification_Notification(mNotification, mUser); log.Result(result); return(result); } catch (Exception ex) { log.Exception(ex); throw; } }
public async Task <ANotification_NotificationList> GetNotificationsAsync(bool?acknowledged, int recordCount) { using var log = BeginFunction(nameof(NotificationAdminService), nameof(GetNotificationsAsync), acknowledged, recordCount); try { await Assert(SecurityPolicy.IsPrivileged).ConfigureAwait(false); var notifications = new List <ANotification_Notification>(); var mNotifications = await CommunicationMicroService.GetNotificationsAsync(recordCount, acknowledged).ConfigureAwait(false); foreach (var mNotification in mNotifications.Notifications) { var mUser = mNotification.ParticipantReference != null && TryParseUserId.FromParticipantReference(mNotification.ParticipantReference, out string userId) ? await UserMicroService.GetUserAsync(userId) : null; var notification = Create.ANotification_Notification(mNotification, mUser); notifications.Add(notification); } var result = new ANotification_NotificationList() { Notifications = notifications }; log.Result(result); return(result); } catch (Exception ex) { log.Exception(ex); throw; } }