Пример #1
0
        public async Task <IActionResult> OnPostConfirmAsync()
        {
            Notification = await NotificationRepository.GetNotificationAsync(NotificationId);

            var(permissionLevel, _) = await _authorizationService.GetPermissionLevelAsync(User, Notification);

            if (permissionLevel != PermissionLevel.Edit)
            {
                return(ForbiddenResult());
            }

            DenotificationDetails.DateOfNotification = Notification.NotificationDate;
            ValidationService.TrySetFormattedDate(DenotificationDetails,
                                                  "DenotificationDetails",
                                                  nameof(DenotificationDetails.DateOfDenotification),
                                                  FormattedDenotificationDate);
            TryValidateModel(DenotificationDetails, "DenotificationDetails");
            if (!ModelState.IsValid)
            {
                NotificationBannerModel = new NotificationBannerModel(Notification);
                return(Page());
            }

            if (Notification.NotificationStatus == NotificationStatus.Notified)
            {
                await Service.DenotifyNotificationAsync(
                    NotificationId,
                    DenotificationDetails,
                    User.FindFirstValue(ClaimTypes.Upn));
            }

            return(RedirectToPage("/Notifications/Overview", new { NotificationId }));
        }
        protected async Task AuthorizeAndSetBannerAsync()
        {
            var(permissionLevel, reason) = await _authorizationService.GetPermissionLevelAsync(User, Notification);

            PermissionLevel         = permissionLevel;
            PermissionReason        = reason;
            NotificationBannerModel = new NotificationBannerModel(Notification, PermissionLevel != PermissionLevel.Edit);
        }
Пример #3
0
        public async Task <IActionResult> OnPostCancelAsync()
        {
            Notification = await NotificationRepository.GetNotificationAsync(NotificationId);

            TransferAlert = await _alertRepository.GetOpenTransferAlertByNotificationId(NotificationId);

            await _alertService.DismissAlertAsync(TransferAlert.AlertId, User.Username());

            NotificationBannerModel = new NotificationBannerModel(Notification);
            return(Partial("_CancelTransferConfirmation", this));
        }
        public async Task <IActionResult> OnGetAsync()
        {
            Notification = await NotificationRepository.GetNotificationAsync(NotificationId);

            if (Notification == null)
            {
                return(NotFound());
            }

            if (Notification.NotificationStatus != NotificationStatus.Draft)
            {
                return(RedirectToPage("/Notifications/Overview", new { NotificationId }));
            }

            NotificationBannerModel = new NotificationBannerModel(Notification);

            return(Page());
        }
Пример #5
0
        public async Task <IActionResult> OnPostConfirmAsync()
        {
            Notification = await NotificationRepository.GetNotificationAsync(NotificationId);

            if (!ModelState.IsValid)
            {
                NotificationBannerModel = new NotificationBannerModel(Notification);
                return(Page());
            }

            if (Notification.NotificationStatus == NotificationStatus.Draft)
            {
                await Service.DeleteNotificationAsync(NotificationId, DeletionReason);

                return(Partial("_DeleteConfirmation", this));
            }

            return(RedirectToPage("/Notifications/Overview", new { NotificationId }));
        }