public async Task <IActionResult> PutComanda([FromRoute] int id, [FromBody] Comanda comanda) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != comanda.IdComanda) { return(BadRequest()); } _context.Entry(comanda).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ComandaExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutPedido([FromRoute] Guid id, [FromBody] Pedido pedido) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != pedido.Id) { return(BadRequest()); } _context.Entry(pedido).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PedidoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }