Esempio n. 1
0
        public ActionResult DoSearch(SearchParameters tmpSearch)
        {
            DebugUtils.StartLogEvent("HomeController.DoSearch");


            if (string.IsNullOrEmpty(tmpSearch.ReservationType))
            {
                tmpSearch.ReservationType = "1";
            }
            if (tmpSearch.ReservationType == "2" && !string.IsNullOrEmpty(tmpSearch.DestinationBonusTime))
            {
                tmpSearch.Destination = tmpSearch.DestinationBonusTime;
            }

            if (tmpSearch.Destination != null && !tmpSearch.Destination.ToLower().Contains("all-"))
            {
                tmpSearch.CheckInDate  = DateTime.MinValue;
                tmpSearch.CheckOutDate = DateTime.MinValue;
            }
            SearchParametersManager searchParametersManager = new SearchParametersManager(false);

            searchParametersManager.parameter = tmpSearch;

            searchParametersManager.SaveParameters();

            DebugUtils.EndLogEvent("HomeController.DoSearch");
            if (tmpSearch.Destination == null)
            {
                return(null);
            }
            else
            {
                return(Redirect(SitecoreUtils.GetPageUrl(SitecoreItemReferences.SearchResultPage)));
            }
        }
Esempio n. 2
0
        public ActionResult Search()
        {
            DebugUtils.StartLogEvent("ResortController.Search");

            if (Request.RawUrl.ToLower() != "/home")
            {
                SearchParametersManager searchParametersManager = new SearchParametersManager();

                var model = GetLayoutItem <SearchResult>();
                SearchUtils.ValidateSearchOptions(model);  //Removes any Resorts the user doesn't have access
                model.SavedSearches = SearchUtils.GetSavedSearches();

                var resortInfo = GetLayoutItem <ResortDetails>();
                if ((model.AllResorts.FindIndex(m => m.ResortId == resortInfo.ResortId) != -1))
                {
                    model.searchParameters.ResortId = resortInfo.ResortId.ToString();
                    model.CurrentResortName         = resortInfo.ResortName;
                    searchParametersManager.parameter.Destination = "city-" + resortInfo.City;
                }
                DebugUtils.EndLogEvent("ResortController.Search");
                return(View(model));
            }
            DebugUtils.EndLogEvent("ResortController.Search");

            return(new EmptyResult());
        }