//returns if there is flight restrictions from one country to another public static bool HasRestriction( Country from, Country to, DateTime date, FlightRestriction.RestrictionType type) { FlightRestriction restriction = GetRestrictions() .Find( r => (r.From == from || (r.From is Union && ((Union) r.From).IsMember(from, date))) && (r.To == to || (r.To is Union && ((Union) r.To).IsMember(to, date))) && (date >= r.StartDate && date <= r.EndDate) && r.Type == type); //FlightRestriction res = GetRestrictions().Find(r => r.From == from && r.To == to && r.Type == type); return restriction != null; }
public static void AddRestriction(FlightRestriction restriction) { Restrictions.Add(restriction); }