public ActionResult SearchBar( [Bind(Prefix = StorefrontConstants.QueryStrings.SearchKeyword)] string searchKeyword) { var model = new SearchBarModel { SearchKeyword = searchKeyword }; return(View("SearchBar", model)); }
/// <summary> /// The action for rendering the search bar. /// </summary> /// <param name="searchKeyword">The search keyword.</param> /// <returns>The search view.</returns> public ActionResult SearchBar( [Bind(Prefix = StorefrontConstants.QueryStrings.SearchKeyword)] string searchKeyword) { var model = new SearchBarModel { SearchKeyword = searchKeyword }; return(this.View(this.CurrentRenderingView, model)); }
public NewEventPageViewModel(INavigationService navigationService) : base(navigationService) { _apiService = new ApiService(); _secureStorage = CrossSecureStorage.Current; Event = new EventModel(); SearchBarListView = new SearchBarModel(); Event.CurrencyCode = CurrencyHelper.GetCurrencyCodeFromCountry(); }
public ActionResult ShowTripData(SearchBarModel f) { if (tp == null) { tp = new TripContext(); } List <Trip> l_t = new List <Trip>(); if (f.source == null && f.destination == null && f.date == null) //all fields null { l_t = tp.Trips.ToList(); } else if (f.source == null && f.destination == null) //only date is provided { l_t = tp.Trips.Where(u => u.date == f.date).ToList(); } else if (f.source == null && f.date == null) //only destination is provided { l_t = tp.Trips.Where(u => u.destination == f.destination).ToList(); } else if (f.destination == null && f.date == null) //only source is provided { l_t = tp.Trips.Where(u => u.source == f.source).ToList(); } else if (f.date == null) //Source and destination are provided { l_t = tp.Trips.Where(u => u.source == f.source && u.destination == f.destination).ToList(); } else if (f.destination == null) //Source and date are provided { l_t = tp.Trips.Where(u => u.source == f.source && u.date == f.date).ToList(); } else if (f.source == null) // destination and date are provided { l_t = tp.Trips.Where(u => u.destination == f.destination && u.date == f.date).ToList(); } else //all fields are provided { l_t = tp.Trips.Where(u => u.source == f.source && u.date == f.date && u.destination == f.destination).ToList(); } return(View("ShowTripData", l_t)); }
public void ShowTripDataTest() { trips.Add(trip1); trips.Add(trip2); TestDbContextTrip t_c_t = new TestDbContextTrip(trips); t_c_t.Trips.Add(trip1); t_c_t.Trips.Add(trip2); SearchBarModel searchBarModel = new SearchBarModel { source = "charlotte", }; var tripController = new TripController(t_c_t); var result = tripController.ShowTripData(searchBarModel) as ViewResult; List <Trip> model = (List <Trip>)tripController.ViewData.Model; Assert.AreEqual(trip2, model[0]); }