public async Task <IActionResult> Edit(int id, [Bind("Id,Nombre,Abreviatura")] Departamento departamento) { if (id != departamento.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(departamento); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DepartamentoExists(departamento.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(departamento)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Nombre,Apellido,Telefono,Email,Imagen")] 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("Id,Nombre,Direccion,CIF,Pais")] Empresa empresa) { if (id != empresa.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(empresa); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmpresaExists(empresa.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(empresa)); }