Exemple #1
0
        protected void Session_Start(object sender, EventArgs e)
        {
            SessionHelper sessionHlp = new SessionHelper();

            A00964856_ShoppingCartEntities db = new A00964856_ShoppingCartEntities();

            VisitRepo visitRepo = new VisitRepo(db);
            visitRepo.ClearVisitsOlderThan(sessionHlp.Expired);
            visitRepo.RemoveSessionID(sessionHlp.SessionID);
            visitRepo.RegisterNewVisit(sessionHlp.SessionID, sessionHlp.Start);
        }
        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;
        }
        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");
        }