public ICourse AddBook( string isbn ) { const string ROUTE = ""; var bookIsbn = new Valence.IsbnAssociation { Isbn = isbn }; var client = CreateClient(); var request = CreateContentRequest( ROUTE, Method.POST ); request.AddBody( bookIsbn ); var response = client.Execute<Valence.Book>( request ); if(( response.StatusCode != HttpStatusCode.OK ) || ( response.Data.Isbn != isbn )) { throw new InvalidOperationException( "Unable to add isbn to course. Returned status: " + response.StatusCode ); } return this; }
public ICourse AddBook(string isbn) { const string ROUTE = ""; var bookIsbn = new Valence.IsbnAssociation { Isbn = isbn }; var client = CreateClient(); var request = CreateContentRequest(ROUTE, Method.POST); request.AddBody(bookIsbn); var response = client.Execute <Valence.Book>(request); if ((response.StatusCode != HttpStatusCode.OK) || (response.Data.Isbn != isbn)) { throw new InvalidOperationException("Unable to add isbn to course. Returned status: " + response.StatusCode); } return(this); }