public IHttpActionResult PutBookAuthorCoupling(int id, BookAuthorCoupling bookAuthorCoupling) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != bookAuthorCoupling.Id) { return(BadRequest()); } db.Entry(bookAuthorCoupling).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!BookAuthorCouplingExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetBookAuthorCoupling(int id) { BookAuthorCoupling bookAuthorCoupling = db.BookAuthorCouplings.Find(id); if (bookAuthorCoupling == null) { return(NotFound()); } return(Ok(bookAuthorCoupling)); }
public IHttpActionResult PostBookAuthorCoupling(BookAuthorCoupling bookAuthorCoupling) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.BookAuthorCouplings.Add(bookAuthorCoupling); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = bookAuthorCoupling.Id }, bookAuthorCoupling)); }
public IHttpActionResult DeleteBookAuthorCoupling(int id) { BookAuthorCoupling bookAuthorCoupling = db.BookAuthorCouplings.Find(id); if (bookAuthorCoupling == null) { return(NotFound()); } db.BookAuthorCouplings.Remove(bookAuthorCoupling); db.SaveChanges(); return(Ok(bookAuthorCoupling)); }