Esempio n. 1
0
        public void GetGigs_GigsIsInThePast_ShouldNotBeReturned()
        {
            var gig = new Gig()
            {
                DateTime = DateTime.UtcNow.ToLocalTime().AddDays(-7),
                ArtistId = _artistId
            };

            _gigs.SetSource(new[] { gig });

            var result = _repository.GetGigs(_artistId);

            result.Should().BeEmpty();
        }
Esempio n. 2
0
        public ActionResult Index(string query = null)
        {
            var userId = User.Identity.GetUserId();

            //var upcomingGigs = userId != null ? _gigReposiory.GetGigsUserAttending(userId) : _gigReposiory.GetGigs();

            var upcomingGigs = _gigReposiory.GetGigs();


            var attendances = _attendanceRepository.GetFutureAttendances(userId).ToLookup(a => a.GigId);

            if (!String.IsNullOrWhiteSpace(query))
            {
                upcomingGigs =
                    upcomingGigs.Where(g =>
                                       g.Artist.Name == query ||
                                       g.Genre.Name == query ||
                                       g.Venue == query);
            }

            var viewModel = new GigsViewModel
            {
                UpcomingGigs = upcomingGigs,
                showAction   = User.Identity.IsAuthenticated,
                Heading      = "Upcoming Gigs",
                SearchTeam   = query,
                Attendances  = attendances,
            };

            return(View("Gigs", viewModel));
        }