public IHttpActionResult PutBranchBook(int id, BranchBook branchBook)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != branchBook.ID)
            {
                return(BadRequest());
            }

            db.Entry(branchBook).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BranchBookExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult GetBranchBook(int id)
        {
            BranchBook branchBook = db.BranchBooks.Find(id);

            if (branchBook == null)
            {
                return(NotFound());
            }

            return(Ok(branchBook));
        }
        public IHttpActionResult PostBranchBook(BranchBook branchBook)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.BranchBooks.Add(branchBook);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = branchBook.ID }, branchBook));
        }
        public IHttpActionResult DeleteBranchBook(int id)
        {
            BranchBook branchBook = db.BranchBooks.Find(id);

            if (branchBook == null)
            {
                return(NotFound());
            }

            db.BranchBooks.Remove(branchBook);
            db.SaveChanges();

            return(Ok(branchBook));
        }