Exemplo n.º 1
0
 public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
 {
     if (!IsRoot && !ParentCharacterGroupIds.Any())
     {
         yield return(new ValidationResult("Character group should be part of tree"));
     }
     if (IsSpecial)
     {
         if (ParentGroups.Any(pg => !pg.IsRoot && !pg.IsSpecial))
         {
             yield return(new ValidationResult("Special group can only be child of root group or another special group"));
         }
     }
     else
     {
         if (ParentGroups.Any(pg => pg.IsSpecial))
         {
             yield return(new ValidationResult("Non-special group can't be child of special group"));
         }
         if (ParentGroups.Any(pg => pg.CharacterGroupId == CharacterGroupId))
         {
             yield return(new ValidationResult("Character group can't be self-child"));
         }
     }
 }
Exemplo n.º 2
0
 public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
 {
     if (!ParentCharacterGroupIds.Any())
     {
         yield return(new ValidationResult("Персонаж должен принадлежать хотя бы к одной группе"));
     }
     if (!IsAcceptingClaims && IsHot)
     {
         yield return(new ValidationResult("На горячую роль должны приниматься заявки"));
     }
 }