public ActionResult Search(int page = 1, int pageSize = 6) { //Display Active Search Place ViewBag.isActive = UtilContants.PLACE_NAV; int fromPlace = int.Parse(Request.Params["txtFromPlace"]); ViewBag.fromPlaces = fromPlace; int toPlace = int.Parse(Request.Params["txtToPlace"]); ViewBag.toPlaces = toPlace; DateTime timeBegin = DateTime.Parse(Request.Params["timeBegin"]); ViewBag.timeBegins = timeBegin; int traveler = int.Parse(Request.Params["traveler"]); ViewBag.travelers = traveler; var search = new SearchTourModel(); var searchResult = search.tourSearchTour(fromPlace, toPlace, timeBegin, traveler).ToPagedList(page, pageSize); TourModel home = new TourModel(); // this row will show when user search empty ViewBag.fromPlaceError = fromPlace; ViewBag.toPlaceError = toPlace; var listComboBoxToPlace = home.listComboBoxToPlace(); var listComboBoxFromPlace = home.listComboBoxFromPlace(); ListContainerTravel listContainer = new ListContainerTravel(); listContainer.Tour = searchResult; listContainer.listComboBoxFromPlace = listComboBoxFromPlace; listContainer.listComboBoxToPlace = listComboBoxToPlace; return(View(listContainer)); }
public ActionResult Tour(int page = 1, int pageSize = 6) { //Display Active Tour ViewBag.isActive = UtilContants.PLACE_NAV; ToursModel model = new ToursModel(); TourModel home = new TourModel(); var tours = model.listAllTours().ToPagedList(page, pageSize); var listComboBoxToPlace = home.listComboBoxToPlace(); var listComboBoxFromPlace = home.listComboBoxFromPlace(); ListContainerTravel listContainer = new ListContainerTravel(); listContainer.Tour = tours; listContainer.listComboBoxFromPlace = listComboBoxFromPlace; listContainer.listComboBoxToPlace = listComboBoxToPlace; return(View(listContainer)); }