public IHttpActionResult PutBookGenreCoupling(int id, BookGenreCoupling bookGenreCoupling) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != bookGenreCoupling.Id) { return(BadRequest()); } db.Entry(bookGenreCoupling).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!BookGenreCouplingExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetBookGenreCoupling(int id) { BookGenreCoupling bookGenreCoupling = db.BookGenreCouplings.Find(id); if (bookGenreCoupling == null) { return(NotFound()); } return(Ok(bookGenreCoupling)); }
public IHttpActionResult PostBookGenreCoupling(BookGenreCoupling bookGenreCoupling) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.BookGenreCouplings.Add(bookGenreCoupling); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = bookGenreCoupling.Id }, bookGenreCoupling)); }
public IHttpActionResult DeleteBookGenreCoupling(int id) { BookGenreCoupling bookGenreCoupling = db.BookGenreCouplings.Find(id); if (bookGenreCoupling == null) { return(NotFound()); } db.BookGenreCouplings.Remove(bookGenreCoupling); db.SaveChanges(); return(Ok(bookGenreCoupling)); }