public async Task <IActionResult> Edit(int id, [Bind("Id,Nome,DataNascimento,Email,Telefone,PedidoId")] 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, Pedido pedido) { if (id != pedido.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(pedido); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PedidoExists(pedido.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(pedido)); }
public async Task UpdateDBAsync(ItensPedido itp) { var pedidoId = _context.Pedido.Select(p => p.Id); var prodId = _context.Produto.Select(p => p.Id); _context.Update(itp); await _context.SaveChangesAsync(); }