// GET: /Search/ public ActionResult Index() { var profiles = db.Profiles.Get(); var resultsView = new SearchView { SearchBox = new SearchBoxView(), SearchResults = CreateSearchResultMapping(profiles) }; return View(resultsView); }
public ActionResult Index(SearchBoxView searchBoxView) { var min = DateTime.Today.AddYears(-(searchBoxView.AgeTo + 1)); var max = DateTime.Today.AddYears(-searchBoxView.AgeFrom); var profiles = db.Profiles.Get( p => searchBoxView.Gender.Contains(p.Gender) && p.Birthday >= min && p.Birthday <= max ); var resultsView = new SearchView { SearchBox = searchBoxView, SearchResults = CreateSearchResultMapping(profiles) }; // Set current user as online Helpers.User.SetOnline(); return View(resultsView); }