public async Task <IActionResult> PutBookstoreOrder(int id, BookstoreOrder bookstoreOrder) { if (id != bookstoreOrder.Id) { return(BadRequest()); } _context.Entry(bookstoreOrder).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BookstoreOrderExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <BookstoreOrder> > PostBookstoreOrder(BookstoreOrder bookstoreOrder) { _context.BookstoreOrder.Add(bookstoreOrder); await _context.SaveChangesAsync(); // return CreatedAtAction("GetBookstoreOrder", new { id = bookstoreOrder.Id }, bookstoreOrder); return(CreatedAtAction(nameof(GetBookstoreOrder), new { id = bookstoreOrder.Id }, bookstoreOrder)); }