public IActionResult CreateVehiculo() { VehiculoVM vehiculovm = new VehiculoVM() { Vehiculo = new Lagazzi.Models.Vehiculo(), ListaTipoVehiculo = _contenedorTrabajo.TipoVehiculo.GetListaTipoVehiculo() }; return(View(vehiculovm)); }
public IActionResult EditarVehiculo(VehiculoVM vehiculovm) { var vehiculoDesdeDb = _contenedorTrabajo.Vehiculo.Get(vehiculovm.Vehiculo.Id); if (ModelState.IsValid) { _contenedorTrabajo.Vehiculo.Update(vehiculovm.Vehiculo); _contenedorTrabajo.Save(); return(RedirectToAction(nameof(Index))); } return(View()); }
public IActionResult CreateVehiculo(VehiculoVM vehiculovm) { if (ModelState.IsValid) { if (vehiculovm.Vehiculo.Id == 0) { _contenedorTrabajo.Vehiculo.Add(vehiculovm.Vehiculo); _contenedorTrabajo.Save(); return(RedirectToAction(nameof(Index))); } } return(View()); }
public IActionResult EditarVehiculo(int?id) { VehiculoVM vehiculovm = new VehiculoVM() { Vehiculo = new Lagazzi.Models.Vehiculo(), ListaTipoVehiculo = _contenedorTrabajo.TipoVehiculo.GetListaTipoVehiculo() }; if (id != null) { vehiculovm.Vehiculo = _contenedorTrabajo.Vehiculo.Get(id.GetValueOrDefault()); } return(View(vehiculovm)); }