public bool IsInAgeRange(int age) { string[] str = RangeOfAge.Split('-'); int minAge = int.Parse(str[0]), maxAge = int.Parse(str[1]); return(age >= minAge && age <= maxAge); }
public bool AddParticipant(Member participant) { string[] str = RangeOfAge.Split('-'); int minAge = int.Parse(str[0]), maxAge = int.Parse(str[1]); if (Participants.Count() < MaxParticipants && participant.Age >= minAge && participant.Age <= maxAge && participant.HasCompetitionPass() && (participant.Subscription.Cast <Subscription>().Any(s => s.PassType.Equals(PassType.Competition)) ? participant.Subscription.Cast <Subscription>().First(s => s.PassType.Equals(PassType.Competition)).IsValid() : false)) { Participants.Add(participant); participant.Competitions.Add(this); return(true); } else { return(false); } }