protected TraktSyncHistoryRemovePostBuilder AddShowOrIgnore(ITraktShow show)
        {
            if (ContainsShow(show))
            {
                return(this);
            }

            var historyShow = new TraktSyncHistoryPostShow
            {
                Ids   = show.Ids,
                Title = show.Title,
                Year  = show.Year
            };

            (_historyPost.Shows as List <ITraktSyncHistoryPostShow>)?.Add(historyShow);

            return(this);
        }
        protected void CreateOrSetShow(ITraktShow show, IEnumerable <ITraktSyncHistoryPostShowSeason> showSeasons)
        {
            var existingShow = _historyPost.Shows.FirstOrDefault(s => s.Ids == show.Ids);

            if (existingShow != null)
            {
                existingShow.Seasons = showSeasons;
            }
            else
            {
                var historyShow = new TraktSyncHistoryPostShow
                {
                    Ids   = show.Ids,
                    Title = show.Title,
                    Year  = show.Year,

                    Seasons = showSeasons
                };

                (_historyPost.Shows as List <ITraktSyncHistoryPostShow>)?.Add(historyShow);
            }
        }
Beispiel #3
0
        protected TraktSyncHistoryPostBuilder AddShowOrIgnore(ITraktShow show, DateTime?watchedAt = null)
        {
            if (ContainsShow(show))
            {
                return(this);
            }

            var historyShow = new TraktSyncHistoryPostShow
            {
                Ids   = show.Ids,
                Title = show.Title,
                Year  = show.Year
            };

            if (watchedAt.HasValue)
            {
                historyShow.WatchedAt = watchedAt.Value.ToUniversalTime();
            }

            (_historyPost.Shows as List <ITraktSyncHistoryPostShow>)?.Add(historyShow);

            return(this);
        }