13 public ActionResult Index()
14 {
15 ViewData.Model = Product.Products;
16 return View(“Index”);
17 }
18
19 public ActionResult AddProductToCart(string productID, int quantity)
20 {
21 CartController cartController = new CartController();
22 cartController.AddProduct(productID, quantity);
23 return Index();
24 }
25
26 public ActionResult RateProduct(string productID, string rating)
27 {
28 RatingController ratingController = new RatingController();
29 ratingController.RateProduct(productID, rating);
30 return Index();
31 }
28 public ActionResult DisplayCart()
29 {
30 Cart cart = GetCart();
31 return View(“Cart”, cart);
32 }
33
34 public ActionResult AddProduct(string productID, int quantity)
35 {
36 Cart cart = GetCart();
37 Product product = Product.Products.Find(s => s.ID == productID);
38 cart.AddProduct(product, quantity);
39 SetCart(cart);
40 return View(“Cart”, cart);
41 }
22 private Rating GetRatings()
23 {
24 Rating rating = System.Web.HttpContext.Current.Session["Rating"] as Rating;
25 if (rating == null)
26 {
27 rating = new Rating();
28 }
29 return rating;
30 }
31
32 private void SetRating(Rating rating)
33 {
34 System.Web.HttpContext.Current.Session["Rating"] = rating;
35 }
This method didn’t work for me on the day I received my MSDN shipment – I had to wait a couple days for it to work.
]]>To install the dependencies I used:
sudo apt-get install python-dev libogg-dev libvorbis-dev liblame-dev libfaad-dev libasound2-dev python-pygame
I had to go to /usr/bin and run this as Michael suggests:
ln -s g++-3.4 g++
]]>