public IActionResult DetailedShowingSearch() { ViewBag.AllShowings = GetAllShowings(); ViewBag.AllMovies = GetAllMovies(); //ViewBag.AllShowings = GetAllShowings(); ShowingsViewModel svm = new ShowingsViewModel(); return(View(svm)); }
public IActionResult DisplayShowingResults(ShowingsViewModel svm) { var query = from s in _context.Showings.Include(m => m.Movie) select s; if (String.IsNullOrEmpty(svm.MovieMovie) == false) //JobPostingID not specified { query = query.Where(m => m.Movie.Title.Contains(svm.MovieMovie)); } if (svm.MovieStartTime != null) { query = query.Where(s => s.StartTime <= svm.MovieStartTime); } if (svm.MovieEndTime != null) { query = query.Where(s => s.EndTime <= svm.MovieEndTime); } if (svm.CountSeat != 0) { switch (svm.AscendingDescending) { case SeatSort.Below: query = query.Where(s => s.SeatCount <= svm.CountSeat); ViewBag.AllShowings = _context.Showings.Count(); ViewBag.SelectedShowings = query.Count(); break; case SeatSort.Above: query = query.Where(s => s.SeatCount >= svm.CountSeat); ViewBag.AllShowings = _context.Showings.Count(); ViewBag.SelectedShowings = query.Count(); break; default: break; } } List <Showing> SelectedShowings = query.Include(m => m.Movie).ToList(); //Populate the view bag with a count of all job postings ViewBag.AllShowings = _context.Showings.Count(); //Populate the view bag with a count of selected job postings ViewBag.SelectedShowings = SelectedShowings.Count(); return(View("Index", SelectedShowings.OrderByDescending(s => s.StartTime))); }