Esempio n. 1
0
 public ActionResult Index()
 {
     A00964856_ShoppingCartEntities db = new A00964856_ShoppingCartEntities();
     ProductRepo prodRepo = new ProductRepo(db);
     
     return View(prodRepo.GetProducts());
 }
Esempio n. 2
0
        public ActionResult Add(int prodId)
        {
            SessionHelper sessonHlp = new SessionHelper();
            int qty = sessonHlp.GetProductQtyFromCart(prodId);

            A00964856_ShoppingCartEntities db = new A00964856_ShoppingCartEntities();
            ProductRepo prodRepo = new ProductRepo(db);
            CartItemRepo cartItemRepo = new CartItemRepo(prodRepo);
            CartItemModel item = cartItemRepo.GetCartItem(prodId, qty);

            return View(item);
        }
Esempio n. 3
0
        private bool UpdateCart(CartItemModel cartItem)
        {
            if (cartItem.Quantity < 1) {
                return false;
            }

            SessionHelper sessionHlp = new SessionHelper();
            sessionHlp.AddProductToCart(cartItem.ProductID, cartItem.Quantity);

            A00964856_ShoppingCartEntities db = new A00964856_ShoppingCartEntities();

            ProductRepo prodRepo = new ProductRepo(db);
            VisitRepo visitRepo = new VisitRepo(db);
            ProductVisitRepo prodVisitRepo = new ProductVisitRepo(db);

            Visit visit = visitRepo.GetVisit(sessionHlp.SessionID);
            Product product = prodRepo.GetProduct(cartItem.ProductID);
            prodVisitRepo.AddProductVisit(visit, product, cartItem.Quantity);

            return true;
        }
Esempio n. 4
0
 public VisitRepo(A00964856_ShoppingCartEntities db) : base(db)
 {
 }
Esempio n. 5
0
        public ActionResult ViewCart()
        {
            SessionHelper sessionHlp = new SessionHelper();
            Dictionary<int, int> sessionCart = sessionHlp.GetCart();
            
            A00964856_ShoppingCartEntities db = new A00964856_ShoppingCartEntities();
            ProductRepo prodRepo = new ProductRepo(db);
            CartItemRepo cartItemRepo = new CartItemRepo(prodRepo);
            List<CartItemModel> cartItems = cartItemRepo.GetAllCartItems(sessionCart);

            CheckoutCartModel checkoutCart = new CheckoutCartModel();
            checkoutCart.CartItems = cartItems;

            return View(checkoutCart);
        }
Esempio n. 6
0
        public ActionResult CancelOrder()
        {
            SessionHelper sessionHlp = new SessionHelper();

            A00964856_ShoppingCartEntities db = new A00964856_ShoppingCartEntities();

            VisitRepo visitRepo = new VisitRepo(db);
            visitRepo.ClearVisit(sessionHlp.SessionID);

            sessionHlp.Clear();

            return RedirectToAction("ThankYou");
        }
Esempio n. 7
0
 public BaseRepoClass(A00964856_ShoppingCartEntities db)
 {
     this.db = db;
 }
Esempio n. 8
0
 public ProductRepo(A00964856_ShoppingCartEntities database) : base(database)
 {
 }