public async Task <IActionResult> Edit(int id, [Bind("Id,Nombre,Descripcion,Precio")] Plato plato) { if (id != plato.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(plato); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PlatoExists(plato.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(plato)); }
public async Task <IActionResult> Edit(int id, [Bind("Id")] Restaurant restaurant) { if (id != restaurant.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(restaurant); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RestaurantExists(restaurant.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(restaurant)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,NombreApellido,NombreUsuario,EsAdmin")] Usuario usuario) { if (id != usuario.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(usuario); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UsuarioExists(usuario.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(usuario)); }