예제 #1
0
        private static ComorbidityDetails ExtractComorbidityDetails(MigrationDbNotification notification)
        {
            var details = new ComorbidityDetails();

            details.DiabetesStatus     = Converter.GetStatusFromString(notification.DiabetesStatus);
            details.LiverDiseaseStatus = Converter.GetStatusFromString(notification.LiverDiseaseStatus);
            details.RenalDiseaseStatus = Converter.GetStatusFromString(notification.RenalDiseaseStatus);
            details.HepatitisBStatus   = Converter.GetStatusFromString(notification.HepatitisBStatus);
            details.HepatitisCStatus   = Converter.GetStatusFromString(notification.HepatitisCStatus);
            return(details);
        }
        protected override async Task ValidateAndSave()
        {
            ComorbidityDetails.SetValidationContext(Notification);

            ImmunosuppressionDetails = new ImmunosuppressionDetails {
                Status             = ImmunosuppressionStatus,
                HasBioTherapy      = HasBioTherapy,
                HasTransplantation = HasTransplantation,
                HasOther           = HasOther,
                OtherDescription   = OtherDescription,
            };

            ImmunosuppressionDetails.SetValidationContext(Notification);

            if (TryValidateModel(ComorbidityDetails, nameof(ComorbidityDetails)) &&
                TryValidateModel(ImmunosuppressionDetails, nameof(ImmunosuppressionDetails)))
            {
                await Service.UpdateComorbidityAsync(Notification, ComorbidityDetails);

                await Service.UpdateImmunosuppresionDetailsAsync(Notification, ImmunosuppressionDetails);
            }
        }
        public async Task UpdateComorbidityAsync(Notification notification, ComorbidityDetails comorbidityDetails)
        {
            _context.SetValues(notification.ComorbidityDetails, comorbidityDetails);

            await _notificationRepository.SaveChangesAsync();
        }