// GET: Admin/OrderDetailAdmin public ActionResult Index(int id) { var orderDetail = new OrdersDetailDAO().Detail(id); List <OrdersDetailAdminModel> listO = new List <OrdersDetailAdminModel>(); foreach (var item in orderDetail) { var detail = new OrdersDetailAdminModel(); detail.BillID = item.id_Bill; detail.ID = item.id; detail.ProductID = item.Product.id; detail.ProductName = item.Product == null ? string.Empty : item.Product.name; detail.Price = item.price; detail.Qty = item.qty; detail.ProductImage = item.Product.imagemain; listO.Add(detail); } ViewBag.Product = listO; var order = new OrderDAO().Detail(id); ViewBag.Order = order; return(View()); }
public ActionResult Payment(string shipId, string amount, string shipNote) { var order = new Order(); order.date_created = DateTime.Now; order.id_User = Convert.ToInt32(shipId); order.note = shipNote; order.status = 0; order.amount = Convert.ToDouble(amount); try { var id = new OrderDAO().Insert(order); var cart = (List <CartItemModel>)Session[CartSession]; var detail = new OrdersDetailDAO(); foreach (var item in cart) { var ordersDetail = new OrdersDetail(); ordersDetail.id_Product = item.Product.id; ordersDetail.id_Bill = (int)id; ordersDetail.price = item.Product.price; ordersDetail.qty = item.Qty; ordersDetail.date_created = DateTime.Now; detail.Insert(ordersDetail); } } catch { return(RedirectToAction("Error", "CartClient")); } return(RedirectToAction("Sussecc", "CartClient")); }