public ActionResult Checkout() { var cart = Session["Cart"] as Dictionary <Product, int>; if (cart == null) { cart = new Dictionary <Product, int>(); } var model = new CheckoutCartViewModel(); model.Items = cart; long idCliente = 0; if (Session["User"] != null) { idCliente = (long)(Session["User"] as MyCommerceDemo.Database.tuteweb).idcliente; } var cliente = new CLIENTI(); if (idCliente != 0) { cliente = _db.CLIENTI.Where(i => i.idcliente == idCliente).FirstOrDefault(); } model.Cliente = cliente; return(View(model)); }
public CartsController(ApplicationDbContext db) { _db = db; CheckoutCartVM = new CheckoutCartViewModel(); CartVM = new CartViewModel(); }