internal bool IsPostable()
 {
     return((Movies != null && Movies.Any()) ||
            (Shows != null && Shows.Any()) ||
            (Seasons != null && Seasons.Any()) ||
            (Episodes != null && Episodes.Any()) ||
            (People != null && People.Any()));
 }
Exemple #2
0
        /// <summary>
        /// Ensure that the season is valid
        /// - It isn't blank.
        /// - It doesn't already exist.
        /// </summary>
        public bool NewSeasonValid()
        {
            if (NewSeason == string.Empty)
            {
                return(false);
            }

            return(!Seasons.Any(season => season == NewSeason));
        }
Exemple #3
0
        void AddSeason()
        {
            SeasonViewModel season = new SeasonViewModel();

            season.Changed += (o, ea) => IsChanged = true;
            season.Number   = Seasons.Any() ? Seasons.Max(p => p.Number) + 1 : 1;

            Seasons.Add(season);
            SelectedSeason = season;
        }
        /// <summary>
        ///     Добавить сезоны
        /// </summary>
        public void AddSeasons()
        {
            var number     = Seasons.Count;
            var lastNumber = Seasons.LastOrDefault()?.Number ?? 0;
            var seasons    = new List <Season>();

            for (var i = 0; i < AddingSeasonValue; i++)
            {
                if (number > 0 && number != lastNumber)
                {
                    for (var j = 1; j <= lastNumber; j++)
                    {
                        if (Seasons.Any(s => s.Number == j) ||
                            seasons.Any(s => s.Number == j))
                        {
                            continue;
                        }

                        seasons.Add(new Season
                        {
                            Number = j,
                            Film   = CurrentFilm
                        });
                        lastNumber++;
                        break;
                    }

                    continue;
                }

                seasons.Add(new Season
                {
                    Number = ++number,
                    Film   = CurrentFilm
                });

                lastNumber++;
            }

            InsertEntityListToDb(seasons);
            Seasons        = new BindableCollection <Season>(CurrentFilm.Seasons);
            SelectedSeason = Seasons.Last();
        }
Exemple #5
0
 public bool SeasonExist(int seasonId)
 {
     return(Seasons.Any(x => x.Id == seasonId));
 }