public async Task <IActionResult> PutOrderItemDetails([FromRoute] int id, [FromBody] OrderItemDetails orderItemDetails) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != orderItemDetails.id) { return(BadRequest()); } _context.Entry(orderItemDetails).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrderItemDetailsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void Products(OrderItem orderitem) { using (var db = new OrderItemContext()) { db.Entry(orderitem).State = EntityState.Added; db.SaveChanges(); } }