// POST: api/Book public HttpResponseMessage Post([FromBody] Book newBook) { //int newBookId = bookDBHelper.AddNewBook(newBook); bookDBHelper.AddNewBook(newBook); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created); //response.Headers.Location = new Uri(Request.RequestUri, String.Format("book/{0}", newBookId)); response.Headers.Location = new Uri(Request.RequestUri, String.Format("book/{0}", 1)); return(response); }
public bool AddNewBook(Book book) { book.Id = bookDBHelper.GetNextId(); return(bookDBHelper.AddNewBook(book)); }