コード例 #1
0
        public IActionResult Index()
        {
            SearchModel model = new SearchModel();

            model.Populate(new List <ItemModel>(), Env);
            return(View(model));
        }
コード例 #2
0
        //
        // GET: /Search/
        public ActionResult Index()
        {
            var Sessionregion  = Session["regionValuesHome"];
            var Sessioncountry = Session["countryValuesHome"];
            var Sessionsector  = Session["sectorValuesHome"];
            var Sessiontype    = Session["documentTypesValuesHome"];

            SearchModel model = new SearchModel();


            //Populate Model
            model.Populate(TSMContext.CurrentPage, TSMContext.CurrentLanguageID);

            model.SessionRegion  = Sessionregion == null ? null : Sessionregion.ToString();
            model.SessionCountry = Sessioncountry == null ? null : Sessioncountry.ToString();
            model.SessionSector  = Sessionsector == null ? null : Sessionsector.ToString();
            model.SessionType    = Sessiontype == null ? null : Sessiontype.ToString();


            //model.SessionRegion = Sessionregion.ToString();
            //model.SessionCountry = Sessioncountry.ToString();
            //model.SessionSector = Sessionsector.ToString();
            //model.SessionType = Sessiontype.ToString();

            TempData["region"]  = Sessionregion == null ? null : Sessionregion;
            TempData["country"] = Sessioncountry == null ? null : Sessioncountry;
            TempData["sector"]  = Sessionsector == null ? null : Sessionsector;
            TempData["type"]    = Sessiontype == null ? null : Sessiontype;


            //TempData["region"] = Sessionregion.ToString();
            //TempData["country"] = Sessioncountry.ToString();
            //TempData["sector"] = Sessionsector.ToString();
            //TempData["type"] = Sessiontype.ToString();


            ViewBag.PageTitle       = model.Page_Language.PageTitle;
            ViewBag.PageDescription = model.Page_Language.PageMetadata;
            ViewBag.PageKeywords    = model.Page_Language.PageKeywords;


            return(View("~/Views/Search/Search.cshtml", model));
        }
コード例 #3
0
        public IActionResult Index(SearchModel model)
        {
            if (model == null)
            {
                Console.WriteLine("HttpPost model is Null");
            }
            Console.WriteLine($"SearchString is {model.SearchStr}");
            List <ItemModel> list = new List <ItemModel>();

            foreach (ItemModel it in Repo.GetItemPriceRange(model.LowestPrice, model.HighestPrice))
            {
                if (String.IsNullOrEmpty(model.SearchStr) || it.Name.IndexOf(model.SearchStr) >= 0)
                {
                    list.Add(it);
                }
            }

            model.Populate(list, Env);
            return(View(model));
        }