Exemple #1
0
        protected override async Task ValidateAndSave()
        {
            TravelDetails.SetValidationContext(Notification);
            VisitorDetails.SetValidationContext(Notification);

            CleanModel();

            TryValidateModel(TravelDetails, TravelDetails.GetType().Name);
            TryValidateModel(VisitorDetails, VisitorDetails.GetType().Name);

            if (ModelState.IsValid)
            {
                await Service.UpdateTravelAndVisitorAsync(Notification, TravelDetails, VisitorDetails);
            }
        }
        protected override async Task <IActionResult> PrepareAndDisplayPageAsync(bool isBeingSubmitted)
        {
            TravelDetails  = Notification.TravelDetails;
            VisitorDetails = Notification.VisitorDetails;
            await SetNotificationProperties(isBeingSubmitted, TravelDetails);
            await SetNotificationProperties(isBeingSubmitted, VisitorDetails);

            if (TravelDetails.ShouldValidateFull)
            {
                TryValidateModel(TravelDetails, TravelDetails.GetType().Name);
            }
            if (VisitorDetails.ShouldValidateFull)
            {
                TryValidateModel(VisitorDetails, VisitorDetails.GetType().Name);
            }

            return(Page());
        }