public CharacterSheetViewModel(Character character, bool isCurrentUser) { Character = character; IsCurrentUser = isCurrentUser; var saValidator = new SkillsAndAttributesValidator(Character.Skill, Character.Attribute, Character.Rank); SkillsAndAttributesErrors = saValidator.Validate().ToList(); var mValidator = new MeritsValidator(Character.Skill, Character.Attribute, Character.Rank, Character.Species, Character.CharacterMerits.ToList(), Character.ExtraMeritPoints); MeritsErrors = mValidator.Validate().ToList(); }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { var validator = new MeritsValidator(Skill, Attribute, Rank, Species, Merits, ExtraPoints); return(validator.Validate().Select(err => new ValidationResult(err))); }