// //PUT: /Books/1 public bool Put(int id, Book book) { book.id = id; if (book == null) { throw new ArgumentNullException("book"); } int index = books.FindIndex(p => p.id == book.id); if (index == -1) { return false; } books.RemoveAt(index); books.Add(book); return true; }
// //POST: /Books/ public HttpResponseMessage PostBook(Book book) { books.Add(book); var response = Request.CreateResponse<Book>(HttpStatusCode.Created, book); return response; }