public ActionResult Location(FrontPageModel model) { if (model == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } ViewBag.Loc = from c in db.Courses where c.Location == model.City.ToString() select c; ViewBag.Local = model.City.ToString(); if (ViewBag.Loc == null) { return HttpNotFound(); } return View(ViewBag.Loc); }
// GET: FrontPage public ActionResult Index(FrontPageModel something) { /* List<SelectListItem> list = new List<SelectListItem> { new SelectListItem { Text = "text1", Value = "11"}, new SelectListItem { Text = "text2", Value = "12"}, new SelectListItem {Text = "text3", Value = "13"}, new SelectListItem {Text = "text4", Value = "14"}, new SelectListItem { Text = "text5", Value = "15"} };*/ //Cities citiess = new Cities(); //var allCities = new IEnumerable<CreateModel(); //ViewBag.Locations = new SelectList(allCities.City); return View(something); }