public async Task <IActionResult> PutBooksShelf(int id, BooksShelf booksshelf) { if (id != booksshelf.Id) { return(BadRequest()); } _context.Entry(booksshelf).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BooksShelfExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <BooksShelf> > PostBooksShelf(BooksShelf booksshelf) { _context.BooksShelfs.Add(booksshelf); await _context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetBooksShelf), new { id = booksshelf.Id }, booksshelf)); // return CreatedAtAction("GetBook", new { id = book.Id }, book); }