Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (int.TryParse(RequestContent[4], out BookID) && (Book = Store.GetBook(BookID)) != null)
- {
- //vsetko ok
- if (RequestContent[2] == "ShoppingCart")
- {
- if (RequestContent[3] == "Add")
- {
- try
- {
- if (Customer.ShoppingCart == null)
- {
- //Console.WriteLine("Creating shopping cart for username with id: {0}", Customer.Id);
- Customer.ShoppingCart = new ShoppingCart();
- }
- Customer.AddToCart(Book.Id);
- View.DisplayCart(Customer, Store.GetBooks());
- return;
- }
- catch (Exception)
- {
- Console.WriteLine("pes");
- }
- }
- else if (RequestContent[3] == "Remove")
- {
- if (Customer.RemoveFromCart(Book.Id))
- {
- View.DisplayCart(Customer, Store.GetBooks());
- return;
- }
- }
- }
- //book detail
- else if (RequestContent[2] == "Books" && RequestContent[3] == "Detail")
- {
- View.DisplayBook(Customer, Book);
- return;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement