// GET: ShoppingCart public ActionResult Add(int id) { ShoppingCart cart = (ShoppingCart)Session["cart"]; if (cart == null) { cart = new ShoppingCart(); } ShopModelData db = new ShopModelData(); TraSua trasua = db.TraSuas.Find(id); if (trasua != null) { cart.InsertItem(trasua.mats, trasua.anhts, trasua.tents, (double)trasua.dongia); } Session["cart"] = cart; return(Redirect(Request.UrlReferrer.ToString())); }