public async Task <IActionResult> PutBookTestnew(int id, BookTestnew bookTestnew) { if (id != bookTestnew.BookId) { return(BadRequest()); } _context.Entry(bookTestnew).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BookTestnewExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <BookTestnew> > PostBookTestnew(BookTestnew bookTestnew) { _context.BookTestnew.Add(bookTestnew); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (BookTestnewExists(bookTestnew.BookId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetBookTestnew", new { id = bookTestnew.BookId }, bookTestnew)); }