Exemplo n.º 1
0
        public AssessmentViewModel BuildAssessmentViewModel(Patient patient, Roles roles)
        {
            if (patient == null)
            {
                throw new ArgumentNullException("patient");
            }
            if (roles == null)
            {
                throw new ArgumentNullException("roles");
            }

            var viewModel = new AssessmentViewModel
            {
                StageDescription           = ApplicationStringConstants.Stage1Text,
                StageDescriptionStyle      = ApplicationStringConstants.Stage1ShortDescription,
                Stage1DecisionConfirmation = ApplicationStringConstants.DecisionConfirmationText,
                Stage1InfoText             = ApplicationStringConstants.DecisionPromptText,
                DateAssessmentStarted      = _dateTimeProvider.Now.Date,
                Patient        = Mapper.Map <Patient, PatientViewModel>(patient),
                Roles          = RoleItems(roles),
                PatientSummary = PatientSummary(patient)
            };

            viewModel.Patient.SelectedGender = patient.Gender.Description;
            return(viewModel);
        }
Exemplo n.º 2
0
        public AssessmentViewModel BuildAssessmentViewModel(Assessment assessment, Roles roles)
        {
            if (assessment == null)
            {
                throw new ArgumentNullException("assessment");
            }
            if (roles == null)
            {
                throw new ArgumentNullException("roles");
            }

            var viewModel = BuildAssessmentViewModel(assessment);

            viewModel.Roles = RoleItems(roles);

            return(viewModel);
        }
Exemplo n.º 3
0
 private IEnumerable <SelectListItem> RoleItems(Roles role)
 {
     return(BuildEmptySelectList().Union(role.Items.Select(option => new SelectListItem {
         Text = option.Description, Value = option.RoleId.ToString()
     })));
 }