Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.37 KB | None | 0 0
  1. if (int.TryParse(RequestContent[4], out BookID) && (Book = Store.GetBook(BookID)) != null)
  2.                                 {
  3.  
  4.  
  5.  
  6.                                     //vsetko ok
  7.                                     if (RequestContent[2] == "ShoppingCart")
  8.                                     {
  9.                                         if (RequestContent[3] == "Add")
  10.                                         {
  11.                                             try
  12.                                             {
  13.                                                 if (Customer.ShoppingCart == null)
  14.                                                 {
  15.                                                     //Console.WriteLine("Creating shopping cart for username with id: {0}", Customer.Id);
  16.                                                     Customer.ShoppingCart = new ShoppingCart();
  17.                                                 }
  18.                                                 Customer.AddToCart(Book.Id);
  19.                                                 View.DisplayCart(Customer, Store.GetBooks());
  20.                                                 return;
  21.  
  22.                                             }
  23.                                             catch (Exception)
  24.                                             {
  25.                                                 Console.WriteLine("pes");
  26.                                             }
  27.                                         }
  28.                                         else if (RequestContent[3] == "Remove")
  29.                                         {
  30.                                             if (Customer.RemoveFromCart(Book.Id))
  31.                                             {
  32.                                                 View.DisplayCart(Customer, Store.GetBooks());
  33.                                                 return;
  34.                                             }
  35.  
  36.                                         }
  37.  
  38.                                     }
  39.                                     //book detail
  40.                                     else if (RequestContent[2] == "Books" && RequestContent[3] == "Detail")
  41.                                     {
  42.                                         View.DisplayBook(Customer, Book);
  43.                                         return;
  44.                                     }
  45.  
  46.                                 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement