public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
 {
     var carroCompras = (CarroCompras)controllerContext
                         .HttpContext.Session["CarroCompras"];
     if (carroCompras == null)
     {
         carroCompras = new CarroCompras();
         controllerContext.HttpContext.Session["CarroCompras"] = carroCompras;
     }
     return carroCompras;
 }
        public ActionResult Agregar(CarroCompras carroCompras, int id, [DefaultValue(1)] int cantidad, string regresarUrl)
        {
            using (var session = NHibernateConfigurator.GetSession())
            using (var transaction = session.BeginTransaction())
            {
                var producto = session.Get<Producto>(id);
                carroCompras.AgregarLinea(producto, cantidad);
                transaction.Commit();
            }

            return RedirectToAction("Mostrar", new { regresarUrl });
        }
 public ActionResult Remover(CarroCompras carroCompras, int id, string regresarUrl)
 {
     carroCompras.RemoverLinea(id);
     return RedirectToAction("Mostrar", new { regresarUrl });
 }
 public ActionResult Mostrar(CarroCompras carroCompras, string regresarUrl)
 {
     ViewBag.RegresarUrl = regresarUrl;
     return View(carroCompras);
 }