Пример #1
0
 public ActionResult Create(BusRoute busRoute)
 {
     if (!ModelState.IsValid)
     {
         var cities = db.GetCities().AsEnumerable();
         ViewBag.FromCityId = new SelectList(cities, "Id", "CityName");
         ViewBag.ToCityId   = new SelectList(cities, "Id", "CityName");
         return(View(busRoute));
     }
     db.AddBusRoute(busRoute);
     return(RedirectToAction("Index"));
 }