public async Task <IActionResult> Edit(int id, [Bind("IdEstado,NombreEstadoDelPedido")] EstadoDelPedido estadoDelPedido) { if (id != estadoDelPedido.IdEstado) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(estadoDelPedido); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EstadoDelPedidoExists(estadoDelPedido.IdEstado)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(estadoDelPedido)); }
public async Task <IActionResult> Create([Bind("IdEstado,NombreEstadoDelPedido")] EstadoDelPedido estadoDelPedido) { if (ModelState.IsValid) { _context.Add(estadoDelPedido); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(estadoDelPedido)); }