Exemple #1
0
        public ActionResult Index(string query = null)
        {
            var upcomingGos = _context.Gos
                              .Include(g => g.Artical)
                              .Include(g => g.Genre)
                              .Where(g => g.DateTime > DateTime.Now && !g.IsCanceled);

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

            var ViewModel = new GosViewModel
            {
                UpcomingGos = upcomingGos,
                ShowActions = User.Identity.IsAuthenticated,
                Heading     = "Upcoming Gos",
                SearchTerm  = query
            };

            return(View("Gos", ViewModel));
        }
Exemple #2
0
        public ActionResult Attending()
        {
            var userId = User.Identity.GetUserId();
            var gos    = _context.Attendances
                         .Where(a => a.AttendeeId == userId)
                         .Select(a => a.Go)
                         .Include(g => g.Artical)
                         .Include(g => g.Genre)
                         .ToList();

            var ViewModel = new GosViewModel()
            {
                UpcomingGos = gos,
                ShowActions = User.Identity.IsAuthenticated,
                Heading     = "Gos I'm Attending"
            };

            return(View("Gos", ViewModel));
        }
Exemple #3
0
 public ActionResult Search(GosViewModel viewModel)
 {
     return(RedirectToAction("Index", "Home", new { query = viewModel.SearchTerm }));
 }