Exemplo n.º 1
0
        public static bool TryGetClassSeries(string series, out AdeptClassSeries outSeries)
        {
            var trySeries = allClasses.Where(s => s.Name.ToUpper().Contains(series.ToUpper()) || s.Classes.Any(c => c.Name.ToUpper().Contains(series.ToUpper())));

            if (trySeries.FirstOrDefault() == null)
            {
                outSeries = null;
                return(false);
            }
            else
            {
                outSeries = trySeries.Where(s => s.Classes.Any(c => c.Name.ToUpper() == series.ToUpper())).FirstOrDefault() ?? trySeries.FirstOrDefault();
            }

            return(true);
        }
Exemplo n.º 2
0
        public static bool TryGetClassSeries(string series, out AdeptClassSeries outSeries)
        {
            if (series == "")
            {
                outSeries = null;
                return(false);
            }

            var trySeries = AllClasses.Where(s =>
                                             s.Name.ToUpper().Contains(series.ToUpper()) ||
                                             s.Classes.Any(c => c.Name.ToUpper().Contains(series.ToUpper())));

            if (trySeries.FirstOrDefault() == null)
            {
                outSeries = null;
                return(false);
            }

            outSeries =
                trySeries.FirstOrDefault(s => s.Classes.Any(c => c.Name.Equals(series, StringComparison.CurrentCultureIgnoreCase))) ??
                trySeries.FirstOrDefault();

            return(true);
        }