private void ValidateInjurySelection(InjuryDetailsViewModel model, SeverityOfInjuryEnum[] severityTypesThatRequireInjuryAndBodyParts) { if (severityTypesThatRequireInjuryAndBodyParts.Contains(model.SeverityOfInjury.Value) && (model.SelectedInjuryIds == null || !model.SelectedInjuryIds.Any())) { ModelState.AddModelError("Injury", "Please select injuries suffered."); } if (model.SelectedInjuryIds != null && model.SelectedInjuryIds.Contains(Injury.UNKOWN_INJURY) && string.IsNullOrEmpty(model.CustomInjuryDescription)) { ModelState.AddModelError("CustomInjuryDescription", "Please provide description of unknown injury."); } }
private void ValidateBodyPartSelection(InjuryDetailsViewModel model, SeverityOfInjuryEnum[] severityTypesThatRequireInjuryAndBodyParts) { if (severityTypesThatRequireInjuryAndBodyParts.Contains(model.SeverityOfInjury.Value) && (model.SelectedBodyPartIds == null || !model.SelectedBodyPartIds.Any())) { ModelState.AddModelError("BodyPartsSection", "Please select body parts injured."); } if (model.SelectedBodyPartIds != null && model.SelectedBodyPartIds.Contains(BodyPart.UNKOWN_BODY_PART) && string.IsNullOrEmpty(model.CustomBodyPartyDescription)) { ModelState.AddModelError("CustomBodyPartyDescription", "Please provide description of unknown location."); } }