public IActionResult CreateBus(BusParkViewModel newBus) { string busType = newBus.Type switch { "school" => "special", "administration" => "special", "special" => "special", "city" => "ordinary", "ordinary" => "ordinary", "touristic" => "touristic", _ => "special" }; var bus = new Bus() { Model = newBus.Model, Type = newBus.Type, Capacity = newBus.Capacity, Price = newBus.Price, RoutePlan = _tripRouteRepository.GetByType(busType) }; _busRepository.Save(bus); return(RedirectToAction("Index")); }
public IActionResult BusPark() { var model = new BusParkViewModel() { Model = "ikar", Type = "ordinary", Capacity = 100, Price = 10 }; return(View(model)); }
public IActionResult CreateBus(BusParkViewModel newBus) { var bus = new Bus() { Model = newBus.Model, Type = newBus.Type, Capacity = newBus.Capacity, Price = newBus.Price }; _busRepository.Save(bus); return(RedirectToAction("Index")); }