Exemplo n.º 1
0
        public ActionResult Search()
        {
            Search s = new Search();            
            IEnumerable<SelectListItem> vc = s.getCategory().Select(r => new SelectListItem
            {
                Text = r.vehicle_category_description,
                Value = r.vehicle_category_description
            });

            ViewData["ddlVehicleCategory"] = new SelectList(vc, "Text", "Value");
            IEnumerable<SelectListItem> bc = s.getBodyStyle().Select(r => new SelectListItem
            {
                Text = r.body_style,
                Value = r.body_style
            });

            ViewData["ddlBodyStyle"] = new SelectList(bc, "Text", "Value");
            IEnumerable<SelectListItem> pup = s.getPickUp().Select(r => new SelectListItem
            {
                Text = r.current_city,
                Value = r.current_city
            });

            ViewData["ddlPickUp"] = new SelectList(pup, "Text", "Value");
            SelectList returnCity = new SelectList(new Dictionary<string, string> 
             {
                 {"Adelaide", "Adelaide"},
                 {"Brisbane", "Brisbane"},
                 {"Melbourne", "Melbourne"},
                 {"Sydney", "Sydney"},
                 {"Perth", "Perth" }
             },
             "Value", "Key");
            ViewData["ddlReturnCity"] = returnCity;

            SelectList sort = new SelectList(new Dictionary<string, string> 
             {
                 {"Daily hire rate", "Daily hire rate"},
                 {"Manufacturer Name", "Manufacturer Name"},
                 {"Manufactuere Date", "Manufactuere Date"},                 
             },
              "Value", "Key");
            ViewData["sort"] = sort;


            return View();
        }