Exemplo n.º 1
0
        // GET: /Search/
        public ActionResult Index()
        {
            var profiles = db.Profiles.Get();

            var resultsView = new SearchView
            {
                SearchBox = new SearchBoxView(),
                SearchResults = CreateSearchResultMapping(profiles)
            };

            return View(resultsView);
        }
Exemplo n.º 2
0
        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);
        }