コード例 #1
0
ファイル: HomeController.cs プロジェクト: sivapamanchi/Code
        public ActionResult Search()
        {
            DebugUtils.StartLogEvent("HomeController.Search");
            var model = GetLayoutItem <IndexSearch>();

            model.searchOptions = new SearchResult();
            model.SavedSearches = SearchUtils.GetSavedSearches();

            SearchUtils.ValidateSearchOptions(model.searchOptions, true);  //Removes any Resorts the user doesn't have access
            Session["SearchType"]     = null;
            Session["SearchResortId"] = null;

            if (Session["SearchCity"] != null)
            {
                var city = Session["SearchCity"].ToString();
                if (!string.IsNullOrEmpty(city))
                {
                    var spit = city.Split(',');
                    model.searchOptions.searchParameters.Destination = "city-" + spit[0];
                }
                Session["SearchCity"] = null;
            }
            if (Session["SearchLOS"] != null)
            {
                var los = Convert.ToInt16(Session["SearchLOS"]);
                model.searchOptions.searchParameters.CheckOutDate = model.searchOptions.searchParameters.CheckInDate.AddDays(los);
                Session["SearchLOS"] = null;
            }

            AddBackgroundImage(model);
            DebugUtils.EndLogEvent("HomeController.Search");

            return(View(model));
        }
コード例 #2
0
ファイル: ResortController.cs プロジェクト: sivapamanchi/Code
        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());
        }