public async Task <IActionResult> Edit(int id, [Bind("Id,Nombre,Cedula,TandaLabor,PorcientoComision,FechaIngreso,Estado")] Empleado empleado) { if (id != empleado.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(empleado); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmpleadoExists(empleado.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(empleado)); }
public async Task <IActionResult> Edit(int id, [Bind("IdVehiculo,Descripcion,NumChasis,NumPlaca,IdTipoVehiculo,IdMarca,IdModelo,IdTipoCombustible,Estado")] Vehiculo vehiculo) { if (id != vehiculo.IdVehiculo) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(vehiculo); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VehiculoExists(vehiculo.IdVehiculo)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["IdMarca"] = new SelectList(_context.Marcas, "IdMarca", "Descripcion", vehiculo.IdMarca); ViewData["IdModelo"] = new SelectList(_context.Modelos, "IdModelo", "Descripcion", vehiculo.IdModelo); ViewData["IdTipoCombustible"] = new SelectList(_context.TipoCombustibles, "IdTipoCombustible", "Descripcion", vehiculo.IdTipoCombustible); ViewData["IdTipoVehiculo"] = new SelectList(_context.TipoVehiculos, "IdTipoVehiculo", "Descripcion", vehiculo.IdTipoVehiculo); return(View(vehiculo)); }
public async Task <IActionResult> Edit(int id, [Bind("IdRenta,IdCliente,IdEmpleado,IdInspeccion,IdVehiculo,FechaRenta,FechaDevolucion,MontoDiario,CantidadDias,Comentario,Estado")] RentaDevolucion rentaDevolucion) { if (id != rentaDevolucion.IdRenta) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(rentaDevolucion); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RentaDevolucionExists(rentaDevolucion.IdRenta)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["IdCliente"] = new SelectList(_context.Clientes, "IdCliente", "Nombre", rentaDevolucion.IdCliente); ViewData["IdEmpleado"] = new SelectList(_context.Empleados, "IdEmpleado", "Nombre", rentaDevolucion.IdEmpleado); ViewData["IdVehiculo"] = new SelectList(_context.Vehiculos.Where(c => c.Estado == true), "IdVehiculo", "Descripcion", rentaDevolucion.IdVehiculo); ViewData["IdInspeccion"] = new SelectList(_context.Inspecciones, "IdTransaccion", "IdTransaccion", rentaDevolucion.IdInspeccion); return(View(rentaDevolucion)); }
public async Task <IActionResult> Edit(int id, [Bind("IdMarca,Descripcion,Estado")] Marca marca) { if (id != marca.IdMarca) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(marca); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MarcaExists(marca.IdMarca)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(marca)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Descripcion,Estado")] TipoVehiculo tipoVehiculo) { if (id != tipoVehiculo.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tipoVehiculo); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TipoVehiculoExists(tipoVehiculo.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(tipoVehiculo)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Descripcion,Estado,NoChasis,NoMotor,NoPlaca,TipoVehiculoId,TipoCombustibleId,MarcaId")] Vehiculo vehiculo) { if (id != vehiculo.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(vehiculo); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VehiculoExists(vehiculo.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["MarcaId"] = new SelectList(_context.Marcas, "Id", "Id", vehiculo.MarcaId); ViewData["TipoCombustibleId"] = new SelectList(_context.TiposCombustibles, "Id", "Id", vehiculo.TipoCombustibleId); ViewData["TipoVehiculoId"] = new SelectList(_context.TiposVehiculos, "Id", "Id", vehiculo.TipoVehiculoId); return(View(vehiculo)); }
public async Task <IActionResult> Edit(int id, [Bind("IdModelo,Descripcion,IdMarca,Estado")] Modelo modelo) { if (id != modelo.IdModelo) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(modelo); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ModeloExists(modelo.IdModelo)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["IdMarca"] = new SelectList(_context.Marcas, "IdMarca", "Descripcion", modelo.IdMarca); return(View(modelo)); }
public async Task <IActionResult> Edit(int id, [Bind("IdTransaccion,IdVehiculo,IdCliente,IdEmpleado,Ralladura,GomaRepuesta,Gato,RoturaCristal,PrimeraGoma,SegundaGoma,TerceraGoma,CuartaGoma,CantidadCombustible,Fecha,Estado")] Inspeccion inspeccion) { if (id != inspeccion.IdTransaccion) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(inspeccion); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InspeccionExists(inspeccion.IdTransaccion)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["IdCliente"] = new SelectList(_context.Clientes, "IdCliente", "Nombre", inspeccion.IdCliente); ViewData["IdEmpleado"] = new SelectList(_context.Empleados, "IdEmpleado", "Nombre", inspeccion.IdEmpleado); ViewData["IdVehiculo"] = new SelectList(_context.Vehiculos.Where(c => c.Estado == true), "IdVehiculo", "Descripcion", inspeccion.IdVehiculo); return(View(inspeccion)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,NoRenta,FechaRenta,FechaDevolucion,MontoXDia,CantidadDia,Comentario,Estado,EmpleadoId,VehiculoId,ClienteId")] Renta renta) { if (id != renta.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(renta); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RentaExists(renta.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ClienteId"] = new SelectList(_context.Clientes, "Id", "Id", renta.ClienteId); ViewData["EmpleadoId"] = new SelectList(_context.Empleados, "Id", "Id", renta.EmpleadoId); ViewData["VehiculoId"] = new SelectList(_context.Vehiculos, "Id", "Id", renta.VehiculoId); return(View(renta)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Nombre,Cedula,NoTarjetaCredito,LimiteCredito,TipoPersona,Estado")] Cliente cliente) { if (id != cliente.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(cliente); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClienteExists(cliente.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(cliente)); }
public async Task <IActionResult> Edit(int id, [Bind("IdEmpleado,Nombre,Cedula,IdTanda,Comision,FechaIngreso,Estado")] Empleado empleado) { if (id != empleado.IdEmpleado) { return(NotFound()); } if (!validaCedula(empleado.Cedula)) { ModelState.AddModelError("Cedula", "Cédula incorrecta"); } if (ModelState.IsValid) { try { _context.Update(empleado); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmpleadoExists(empleado.IdEmpleado)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["IdTanda"] = new SelectList(_context.Tandas, "IdTanda", "Descripcion", empleado.IdTanda); return(View(empleado)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Ralladuras,CantidadCombustible,GomaRepuesta,Gato,RoturaCristal,GomaSupDerecha,GomaSupIzquierda,GomaTraseraDerecha,GomaTraseraIzquierda,Fecha,Estado,IdRenta")] Inspeccion inspeccion) { if (id != inspeccion.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(inspeccion); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InspeccionExists(inspeccion.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(inspeccion)); }
public async Task <IActionResult> Edit(int id, [Bind("IdCliente,Nombre,Cedula,TarjetaCr,LimiteCr,IdTipoPersona,Estado")] Cliente cliente) { if (id != cliente.IdCliente) { return(NotFound()); } if (!validaCedula(cliente.Cedula)) { ModelState.AddModelError("Cedula", "Cédula incorrecta"); } if (!ValidateCardNumber(cliente.TarjetaCr)) { ModelState.AddModelError("TarjetaCr", "Tarjeta incorrecta"); } if (ModelState.IsValid) { try { _context.Update(cliente); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClienteExists(cliente.IdCliente)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["IdTipoPersona"] = new SelectList(_context.TipoPersonas, "IdTipoPersona", "Descripcion", cliente.IdTipoPersona); return(View(cliente)); }