public IList <IShow> GetAllShows()
        {
            var shows = _repo.FindAll().AsCached("Shows", new CachedQueryOptions()
            {
                OnInvalidated = (sender, args) => {
                    // This code here is invoked when the query result is invalidated
                    // Always check the args parameter to understand the type of invalidation that occured
                    if (SqlNotificationSource.Data == args.NotificationEventArgs.Source &&
                        SqlNotificationType.Change == args.NotificationEventArgs.Type)
                    {
                        // This is a data change notificaiton, the result set has changed
                    }
                }
            });

            return(shows.ToList());
        }
Beispiel #2
0
        public IDictionary <IShow, IListenedShow> GetBothShowsByYear(int year, Guid userId)
        {
            var shows    = _showRepo.FindAll().Where(x => x.ShowDate.Value.Year == year);
            var listened = GetAllShows().Where(x => x.UserId == userId && x.ShowDate.Year == year);

            var result = (from show in shows
                          join listen in listened on show.Id equals listen.ShowId into temp
                          from t in temp.DefaultIfEmpty()
                          select new { Show = show, ListenedShow = t });

            var dict = new Dictionary <IShow, IListenedShow>();

            foreach (var r in result)
            {
                dict.Add(r.Show, r.ListenedShow);
            }

            return(dict);
        }
Beispiel #3
0
 public IQueryable <IShow> GetAllShows()
 {
     return(_repo.FindAll());
 }
 public Show[] GetAll()
 {
     return(showRepository.FindAll().ToArray());
 }
Beispiel #5
0
        public List <Show> GetAll()
        {
            List <Show> all = showRepo.FindAll();

            return(all);
        }
Beispiel #6
0
 public List <Show> getAllShows()
 {
     return(_showRepository.FindAll());
 }
Beispiel #7
0
        public void AllShows()
        {
            List <Show> shows = showRepository.FindAll();

            Assert.IsTrue(shows.Count == 4);
        }