示例#1
0
        public ActionResult Attending()
        {
            var userId = User.Identity.GetUserId();

            var viewModel = new ConcertsViewModel()
            {
                UpcomingConcerts = _unitOfWork.Concerts.GetConcertsUserAttending(userId),
                ShowActions      = User.Identity.IsAuthenticated,
                Heading          = "Concersts I'm attending",
                Attendances      = _unitOfWork.Attendances.GetFutureAttendances(userId).ToLookup(a => a.ConcertId)
            };

            return(View("Concerts", viewModel));
        }
示例#2
0
        public ActionResult Index(string query = null)
        {
            var upcomingConcerts = _unitOfWork.Concerts.GetUpcomingConcerts(query);

            var userId      = User.Identity.GetUserId();
            var attendances = _unitOfWork.Attendances.GetFutureAttendances(userId)
                              .ToLookup(a => a.ConcertId);

            var viewModel = new ConcertsViewModel
            {
                UpcomingConcerts = upcomingConcerts,
                ShowActions      = User.Identity.IsAuthenticated,
                Heading          = "Upcoming Concerts",
                SearchTerm       = query,
                Attendances      = attendances
            };

            return(View("Concerts", viewModel));
        }
示例#3
0
 public ConcertsPage()
 {
     InitializeComponent();
     BindingContext = new ConcertsViewModel();
 }
示例#4
0
 public ActionResult Search(ConcertsViewModel viewModel)
 {
     return(RedirectToAction("Index", "Home", new { query = viewModel.SearchTerm }));
 }