static void Main(string[] args) { var client = new BookServiceClient(); var book = new Book(1, "Leo Tolstoy", "War and Peace", 25, 1867); client.AddBook(book); book = new Book(2, "Albert Camus", "The stranger", 20, 1942); client.AddBook(book); book = new Book(3, "George Orwell", "1984", 23, 1949); client.AddBook(book); book = new Book(4, "Fyodor Dostoyevsky", "The Brothers Karamazov", 30, 1880); client.AddBook(book); client.UpdatePrice(3, 25); client.GetBookInfo(4); }
private void add_click(object sender, EventArgs e) { if (!name.Value.Equals(string.Empty) && !releaseDate.Value.Equals(string.Empty) && !isbn.Value.Equals(string.Empty)) { if (client.AddBook(name.Value, DateTime.Parse(releaseDate.Value), isbn.Value) > 0) { Page.ClientScript.RegisterStartupScript(typeof(Page), "alert", "<script language=JavaScript>alert('Successful!');</script>"); listBook.InnerHtml = ""; client = new BookServiceClient(); List <Book> bookList = client.GetBook(-1); bookCollection = new Dictionary <int, Book>(); foreach (Book book in bookList) { HtmlGenericControl li = new HtmlGenericControl("li"); li.Attributes.Add("value", book.Id + "-" + book.Name); li.InnerText = book.Name; listBook.Controls.Add(li); bookCollection.Add(book.Id, book); } } else { Page.ClientScript.RegisterStartupScript(typeof(Page), "alert", "<script language=JavaScript>alert('Something went wrong :(');</script>"); } } }
public ActionResult Create([Bind(Include = "BookId,Title,ISBN")] Book book) { if (ModelState.IsValid) { bookClient.AddBook(book); return(RedirectToAction("Index")); } return(View(book)); }
public string AddBookClient(Book newBook) { var book = new BookReferences.Book() { BookID = newBook.BookID, ISBN = newBook.ISBN, Title = newBook.Title }; return(client.AddBook(book)); }
public ActionResult Create(Book book) { try { client.AddBook(book); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(Book book) { try { // TODO: Add insert logic here string createBook = bookClient.AddBook(book); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult AddBook(Book book) { try { if (ModelState.IsValid) { db.AddBook(book); return(RedirectToAction("Index")); } return(View(book)); } catch { return(View()); } }
public ActionResult Create(Book book) { bsc.AddBook(book); return(RedirectToAction("Index", "Book")); }