Exemple #1
0
        public ActionResult CartSummary()
        {
            var carrito = CarritoDeCompra.GetCart(this.HttpContext);

            ViewData["CartCount"] = carrito.GetCount();
            return(PartialView("CartSummary"));
        }
        private void MigrateShoppingCart(string Email)
        {
            var cart = CarritoDeCompra.GetCart(this.HttpContext);

            cart.MigrateCart(Email);
            Session[CarritoDeCompra.CartSessionKey] = Email;
        }
Exemple #3
0
        public ActionResult AddToCart(int id)
        {
            var addedItem = _context.Productos.Single(p => p.Id == id);

            var carrito = CarritoDeCompra.GetCart(this.HttpContext);

            carrito.AddToCart(addedItem);

            return(RedirectToAction("Index"));
        }
Exemple #4
0
        // GET: CarritoDeCompras
        public ActionResult Index()
        {
            var carrito = CarritoDeCompra.GetCart(this.HttpContext);

            var viewModel = new CarritoDeCompraViewModel
            {
                CartItems = carrito.GetCartItmes(),
                CartTotal = carrito.GetTotal()
            };

            return(View(viewModel));
        }
Exemple #5
0
        public ActionResult Save(OrdenVenta ordenVenta)
        {
            ordenVenta.Username    = User.Identity.Name;
            ordenVenta.FechaCompra = DateTime.Now;
            ordenVenta.Delivery    = "Sí";
            ordenVenta.Estado      = "Procede";
            ordenVenta.IGV         = 0.18M;

            storeDB.OrdenesVenta.Add(ordenVenta);
            storeDB.SaveChanges();

            var cart = CarritoDeCompra.GetCart(this.HttpContext);

            cart.CreateOrder(ordenVenta);

            return(RedirectToAction("Complete",
                                    new { id = ordenVenta.Id }));
        }
Exemple #6
0
        public ActionResult RemoveFromCart(int id)
        {
            var carrito = CarritoDeCompra.GetCart(this.HttpContext);

            string itemName = _context.Carritos.Single(p => p.RecordId == id).Producto.Nombre;

            int itemCount = carrito.RemoveFromCart(id);

            var results = new EliminarCarritoDeCompraViewModel
            {
                Message   = Server.HtmlEncode(itemName) + " Ha sido eliminado de su carrito de compras.",
                CartTotal = carrito.GetTotal(),
                CartCount = carrito.GetCount(),
                ItemCount = itemCount,
                DeleteId  = id
            };

            return(Json(results));
        }