public void AddOrModifyBook(string isbn, Book book) { if (book == null) throw new ArgumentNullException("book"); if (Catalog.ItemExists(isbn)) Catalog.UpdateItem(isbn, new CatalogItem { Author = book.Author, Description = book.Description, Isbn = book.Isbn, Language = book.Language, Published = book.Published, Summary = book.Summary, Title = book.Title }); else { book.Isbn = isbn; Catalog.AddItem( new CatalogItem { Author = book.Author, Description = book.Description, Isbn = book.Isbn, Language = book.Language, Published = book.Published, Summary = book.Summary, Title = book.Title }); WebOperationContext.Current.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.Created; } }
public void AddBook(Book book, string redirectUrl) { if (book == null) throw new ArgumentNullException("book"); AddOrModifyBook(book.Isbn, book); }