Пример #1
0
        public void GetFutureAttendances_GigIsInThePast_ShouldNotBeReturned()
        {
            var gig = new Gig {
                DateTime = DateTime.Now.AddDays(-1), ArtistId = "1"
            };
            var attendance = new Attendance {
                AttendeeId = "1", Gig = gig
            };

            _mockAttendances.SetSource(new[] { attendance });

            var attendances = _repository.GetFutureAttendances("1");

            attendances.Should().BeEmpty();
        }
Пример #2
0
        public ActionResult Index(string query = null)
        {
            var upcomingGigs = _context.Gigs
                               .Include(g => g.Artist)
                               .Include(g => g.Genre)
                               .Where(g => g.DateTime > DateTime.Now && !g.IsCanceled);

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

            var userId = User.Identity.GetUserId();

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

            var viewModel = new GigsViewModel()
            {
                UpcomingGigs = upcomingGigs,
                ShowActions  = User.Identity.IsAuthenticated,
                Heading      = "Upcoming Gigs",
                SearchTerm   = query,
                Attendances  = attendances
            };

            return(View("Gigs", viewModel));
        }
Пример #3
0
        public ActionResult Index(String query = null)
        {
            var upcomingGigs = _context.Gigs
                               .Include(g => g.Artist)  //LD we load all the navigational properties
                               .Include(g => g.Genre)
                               .Where(g => g.DateTime > DateTime.Now && !g.IsCanceled);

            //LD Updating the query with the SEARCH
            if (!String.IsNullOrWhiteSpace(query))
            {
                upcomingGigs = upcomingGigs
                               .Where(g =>
                                      g.Artist.Name.Contains(query) ||
                                      g.Genre.Name.Contains(query) ||
                                      g.Venue.Contains(query));
            }


            //LD LOOKUP()
            var userId      = User.Identity.GetUserId();
            var attendances = _AttendanceRepository.GetFutureAttendances(userId)
                              .ToLookup(a => a.GigId);//LD I look into attendance by "GigId", then I add "Attendances" in "GigsViewModel"


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

            return(View("Gigs", viewModel)); //LD before: return View(upcomingGigs);
        }
Пример #4
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));
        }
Пример #5
0
        public ActionResult Index(string query = null)
        {
            var isAuth      = User.Identity.IsAuthenticated;
            var currentUser = User.Identity.GetUserId();

            // Get all the upcoming gigs.
            var upcomingGigs = _context.Gigs
                               .Include(g => g.Artist)
                               .Include(g => g.Genre)
                               .Where(g => g.DateTime > DateTime.Now && !g.IsCanceled);

            // Filter based on the query search.
            if (!String.IsNullOrWhiteSpace(query))
            {
                upcomingGigs = upcomingGigs
                               .Where(u => u.Artist.Name.Contains(query) ||
                                      u.Genre.Name.Contains(query) ||
                                      u.Venue.Contains(query));
            }

            // Get all the gigs the current user is attending.
            var attendances = _attendanceRepository.GetFutureAttendances(currentUser)
                              .ToLookup(a => a.GigId);

            // Create the model.
            var viewModel = new GigsViewModel
            {
                UpcomingGigs = upcomingGigs,
                Attendances  = attendances,
                ShowActions  = isAuth,
                Heading      = "Upcoming Gigs"
            };

            return(View("Gigs", viewModel));
        }
Пример #6
0
        /// <summary>
        /// Index - returns the home view
        /// </summary>
        /// <returns></returns>
        public ActionResult Index(string query = null)
        {
            var upcomingPaddles = _context.Paddles
                                  .Include(p => p.Paddler)
                                  .Include(p => p.Paddler.UserDetails)
                                  .Include(p => p.PaddleType)
                                  .Where(p => p.DateTime > DateTime.Now);

            upcomingPaddles = FilterUpcomingPaddles(query, upcomingPaddles);

            var attendances = AttendanceRepository
                              .GetFutureAttendances(User.Identity.GetUserId())
                              .ToLookup(a => a.PaddleID);

            var viewModel = new PaddleViewModel
            {
                UpcomingPaddles = upcomingPaddles,
                UserAuthorised  = User.Identity.IsAuthenticated,
                Heading         = "Upcoming paddles",
                SearchTerm      = query,
                Attendances     = attendances
            };

            return(View("Paddle", viewModel));
        }
Пример #7
0
        public ActionResult Index(string query = null)
        {
            var upCommingGigs = _context.Gigs
                                .Include(g => g.Artist)
                                .Include(g => g.Genre)
                                .Where(g => g.DateTime > DateTime.Now && !g.IsCanceled);

            if (!string.IsNullOrWhiteSpace(query))
            {
                upCommingGigs =
                    upCommingGigs.Where(
                        g => g.Artist.Name.Contains(query) ||
                        g.Genre.Name.Contains(query) ||
                        g.Venue.Contains(query));
            }

            string userID      = User.Identity.GetUserId();
            var    attendances = _attendanceRepository.GetFutureAttendances(userID).ToLookup(a => a.GigId);

            var vm = new GigsViewModel
            {
                UpcomingGigs = upCommingGigs,
                Authorized   = User.Identity.IsAuthenticated,
                Heading      = "Lista dostępnych Gigów!",
                Search       = query,
                Attendances  = attendances
            };


            return(View("Gigs", vm));
        }
Пример #8
0
        public ActionResult Index(string SearchTerm = null)
        {
            var upcomingGigs = _context.Gigs
                               .Include(g => g.Artist)
                               .Include(g => g.Genre)
                               .Where(g => g.DateTime > DateTime.Now && !g.IsCanceled);

            if (!string.IsNullOrWhiteSpace(SearchTerm))
            {
                upcomingGigs = upcomingGigs
                               .Where(g => g.Artist.Name.Contains(SearchTerm) ||
                                      g.Genre.Name.Contains(SearchTerm) ||
                                      g.Venue.Contains(SearchTerm));
            }

            var userid      = User.Identity.GetUserId();
            var attendances = _attendanceRepository.GetFutureAttendances(userid)
                              .ToLookup(a => a.GigId);

            var viewmodel = new GigViewModel
            {
                Gigs        = upcomingGigs,
                Attendances = attendances
            };


            return(View(viewmodel));
        }
Пример #9
0
        public ActionResult Attending()
        {
            string userId = User.Identity.GetUserId();

            GigsViewModel model = new GigsViewModel();

            model.UpcomingGigs = gigRepository.GetGigsUserAttending(userId);
            model.ShowActions  = User.Identity.IsAuthenticated;
            model.Heading      = "Gigs I'm Attending";
            model.Attendances  = attendanceRepository.GetFutureAttendances(userId).ToLookup(x => x.GigId);
            return(View("Gigs", model));
        }
Пример #10
0
        public ActionResult Attending()
        {
            var userId    = User.Identity.GetUserId();
            var viewModel = new CongregrationsViewModel()
            {
                UpcomingCongregrations = _mahfilMepository.GetMahfilsUserAttending(userId),
                ShowActions            = User.Identity.IsAuthenticated,
                Heading     = "Congregrations I am going",
                Attendances = _attendanceRepository.GetFutureAttendances(userId).ToLookup(x => x.CongregrationId)
            };

            return(View("Congregrations", viewModel));
        }
Пример #11
0
        public ActionResult Attending()
        {
            var userId = User.Identity.GetUserId();

            var viewModel = new GigsViewModel()
            {
                UpcomingGigs = _gigRepository.GetGigUserAttending(userId),
                ShowActions  = true,
                Heading      = "Gigs I'm Attending",
                Attendances  = _attendanceRepository.GetFutureAttendances(userId).ToLookup(a => a.GigId),
            };

            return(View("Gigs", viewModel));
        }
Пример #12
0
        public ActionResult Attending()
        {
            var userId = User.Identity.GetUserId();

            var viewModel = new PaddleViewModel
            {
                UpcomingPaddles = paddleRepository.GetPaddlesUserIsAttending(userId),
                UserAuthorised  = User.Identity.IsAuthenticated,
                Heading         = "Paddles Im Attending",
                Attendances     = attendanceRepository.GetFutureAttendances(userId).ToLookup(a => a.PaddleID)
            };

            return(View("Paddle", viewModel));
        }
Пример #13
0
        public ActionResult Attending()
        {
            var userId = User.Identity.GetUserId();


            var viewModel = new GigsViewModel()
            {
                UpcomingGigs = _unitOfWork.Gigs.GetGigsUserAttending(userId),
                ShowActions  = User.Identity.IsAuthenticated,
                Heading      = "Gigs I'm Attending",
                Attendaces   = _attendanceRepository.GetFutureAttendances(userId).ToLookup(a => a.GigId)
            };

            return(View("Gigs", viewModel));
        }
Пример #14
0
        public ActionResult Index(string query = null)
        {
            var upcomingGigs = _context.Gigs.
                               Include(g => g.Artist)
                               .Include(g => g.Genre)
                               .Where(g => g.DateTime > DateTime.Now && !g.IsCanceled);

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

            var userId = User.Identity.GetUserId();

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

            // var followings = _context.Followings.Where(f => f.FolloweeId == userId && f.FollowerId == ) Trying

            var viewModel = new HomeViewModel
            {
                UpcomingGigs = upcomingGigs,
                ShowActions  = User.Identity.IsAuthenticated,
                Heading      = "Upcoming Gigs",
                SearchTerm   = query,
                Attendances  = attendances
            };

            //if (User.Identity.IsAuthenticated) Trying to fix follow in the index page

            //{
            //    var userId = User.Identity.GetUserId();
            //    viewModel.isfollowing = _context.Followings.Any(a => a.FollowerId == userId && a.FolloweeId == upcomingGigs.ar);
            //}

            return(View("Gigs", viewModel));
        }
Пример #15
0
        public ActionResult Index(string query = null)
        {
            var upcomingCongregration = _context.Congregrations.Include(x => x.Speaker)
                                        .Include(x => x.Genre).Where(x => x.DateTime > DateTime.Now && !x.IsCancelled);

            if (!string.IsNullOrWhiteSpace(query))
            {
                upcomingCongregration = upcomingCongregration.Where(x => x.Speaker.Name.Contains(query) || x.Genre.Name.Contains(query) || x.Venue.Contains(query));
            }

            var userId = User.Identity.GetUserId();

            var viewModel = new CongregrationsViewModel()
            {
                UpcomingCongregrations = upcomingCongregration,
                ShowActions            = User.Identity.IsAuthenticated,
                Heading     = "Upcoming Congregrations",
                SearchTerm  = query,
                Attendances = _attendanceRepository.GetFutureAttendances(userId).ToLookup(x => x.CongregrationId)
            };

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