public ActionResult Index() { var upComingEvents = _context.Events.Include(g => g.Artist) .Include(g => g.Genre) .Where(g => g.DateTime > DateTime.Now).OrderBy(g => g.DateTime); var viewModel = new EventViewsModel { Events = upComingEvents, ShowActions = User.Identity.IsAuthenticated, Heading = "All Upcoming Events" }; return(View("Events", viewModel)); }
public ActionResult Attending() { var userid = User.Identity.GetUserId(); var events = _context.Attendances. Where(a => a.AttendeeId == userid). Select(a => a.Event).Include(a => a.Artist).Include(a => a.Genre).ToList(); var viewModel = new EventViewsModel { Events = events, ShowActions = User.Identity.IsAuthenticated, Heading = "Events I'm Attending" }; return(View("Events", viewModel)); }