public async Task <IActionResult> Edit(int id, [Bind("Id,Nome,Telefone,CPF,Email,Endereco")] 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,IdPedido,IdProduto,Valor,Quantidade")] PedidoProduto pedidoProduto) { if (id != pedidoProduto.IdPedido) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(pedidoProduto); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PedidoProdutoExists(pedidoProduto.IdPedido)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(pedidoProduto)); }