// GET: Order/Create public ActionResult Create() { int size = 0; ProductService pros = new ProductService(); List <orderline> lines = us.getCurrentSessionOrderLines(); if (lines != null) { foreach (var item in lines) { item.product = pros.FindById((long)item.idProduct_fk); } size = lines.Count(); ViewBag.orLines = lines; ViewBag.points = (int)us.getTotalCurrentCart() / 10; } ViewBag.s = size; ViewBag.total = us.getTotalCurrentCart(); order o = new order(); ViewBag.dateToday = DateTime.Now; ViewBag.StatusPayment = "Unpaid"; ViewBag.orderstat = "Waiting for payment"; return(View()); }
public ActionResult AddToCart(int id) { ShoppingCartActions shopping = new ShoppingCartActions(); orderline or = new orderline { idProduct_fk = id, qte = 1 }; shopping.addToCart(or); foreach (var item in shopping.getCurrentSessionOrderLines()) { System.Diagnostics.Debug.WriteLine(" order lines" + item.idProduct_fk + " " + item.qte); } return(RedirectToAction("Index")); }