Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// PUT: api/Order
public async Task<IActionResult> PutOrder([FromBody] Order order)
// Apply changes to context
// Persist changes
await _context.SaveChangesAsync();
catch (DbUpdateConcurrencyException)
if (!_context.Orders.Any(o => o.OrderId == order.OrderId))
return NotFound();
// Populate reference properties
await _context.LoadRelatedEntitiesAsync(order);
// Reset tracking state to unchanged
// Return updated order
return Ok(order);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment