Exemplo n.º 1
0
        public async Task <IActionResult> OnGetAsync()
        {
            PrepareBreadcrumbs();

            Notification = await NotificationRepository.GetNotificationWithAllInfoAsync(NotificationId);

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

            await GetLinkedNotificationsAsync();
            await GetAlertsAsync();
            await AuthorizeAndSetBannerAsync();

            if (PermissionLevel == PermissionLevel.None)
            {
                return(Partial("./UnauthorizedWarning", this));
            }

            // This check has to happen after authorization as otherwise patient will redirect to overview and we'd be stuck in a loop.
            if (Notification.NotificationStatus == NotificationStatus.Draft)
            {
                return(RedirectToPage("./Edit/PatientDetails", new { NotificationId }));
            }

            CultureAndResistance = await _cultureAndResistanceService.GetCultureAndResistanceDetailsAsync(NotificationId);

            GroupedTreatmentEvents = Notification.TreatmentEvents.GroupByEpisode();

            CalculateTreatmentOutcomes();
            return(Page());
        }
        protected override async Task <IActionResult> PrepareAndDisplayPageAsync(bool isBeingSubmitted)
        {
            TestData             = Notification.TestData;
            CultureAndResistance = await _cultureAndResistanceService.GetCultureAndResistanceDetailsAsync(NotificationId);

            Specimens = await _specimenService.GetMatchedSpecimenDetailsForNotificationAsync(NotificationId);

            await SetNotificationProperties(isBeingSubmitted, TestData);

            if (TestData.ShouldValidateFull)
            {
                TryValidateTestData(TestData, nameof(TestData));
            }

            return(Page());
        }
        public async Task <IActionResult> OnGetAsync()
        {
            Notification = await NotificationRepository.GetNotificationWithAllInfoAsync(NotificationId);

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

            await GetLinkedNotificationsAsync();
            await AuthorizeAndSetBannerAsync();

            if (PermissionLevel == PermissionLevel.None)
            {
                return(RedirectToPage("/Notifications/Overview", new { NotificationId }));
            }

            TestData             = Notification.TestData;
            CultureAndResistance = await _cultureAndResistanceService.GetCultureAndResistanceDetailsAsync(NotificationId);

            Specimens = await _specimenService.GetMatchedSpecimenDetailsForNotificationAsync(NotificationId);

            return(Page());
        }