public async Task <IActionResult> Edit(int id, [Bind("Id,Nombre,NumGuia,Patente,Transporte,Conductor,RutConductor,Fecha,Temperatura, NumSello,PesoGuia")] 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("Id,Producto,TipoProducto,UnidadSoportante,CantidadUS,Envase,KgNeto,IdCliente")] Carga carga) { if (id != carga.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(carga); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CargaExists(carga.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(carga)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,IdCarga,Producto,Envase,CantidadEnvases,KgEnvase,FolioExterno")] DetalleCarga detalleCarga) { if (id != detalleCarga.Id) { return(NotFound()); } if (ModelState.IsValid) { try { var producto = _context.Producto.SingleOrDefault(m => m.FolioInterno == detalleCarga.Id); producto.FolioInterno = detalleCarga.Id; producto.Nombre = detalleCarga.Producto; producto.Envase = detalleCarga.Envase; producto.CantidadEnvases = detalleCarga.CantidadEnvases; producto.FolioExterno = detalleCarga.FolioExterno; _context.Update(detalleCarga); await _context.SaveChangesAsync(); _context.Update(producto); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DetalleCargaExists(detalleCarga.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(detalleCarga)); }