public static int CreateProductOrder(int id, int productid, int orderid)
        {
            db = new Database();
            ProductOrderModel data = new ProductOrderModel()
            {
                ProductId = productid,
                OrderId   = orderid,
            };

            return(ProductOrderDao.Insert(db, data));
        }
Пример #2
0
        public ActionResult Detail(int orderId)
        {
            ProductOrderDao productOrderDao = new ProductOrderDao();
            OrderDao        orderDao        = new OrderDao();
            Order           order           = orderDao.GetById(orderId);

            ViewBag.Order      = order;
            ViewBag.TotalPrice = order.TotalPrice;
            IList <ProductOrder> products = productOrderDao.GetAllByOrder(order);

            return(View(products));
        }
Пример #3
0
        public ActionResult TrueCreate()
        {
            OrderDao             orderDao        = new OrderDao();
            Order                order           = TempData["potentialOrder"] as Order;
            IList <ProductOrder> productOrders   = TempData["potentialProductOrders"] as List <ProductOrder>;
            Address              address         = TempData["potentialAddress"] as Address;
            ProductOrderDao      productOrderDao = new ProductOrderDao();


            order.Address = address;
            orderDao.Create(order);

            foreach (ProductOrder p in productOrders)
            {
                p.Order = order;
                productOrderDao.Create(p);
            }

            TempData["message-success"] = "Vaše objednávka byla úspěšně vytvořena";
            Session["cart"]             = null;
            return(RedirectToAction("Index", "Home"));
        }
Пример #4
0
        public ActionResult Detail(int orderId)
        {
            ProductOrderDao productOrderDao = new ProductOrderDao();
            OrderDao        orderDao        = new OrderDao();
            IList <Order>   ordersToExp     = orderDao.GetAllOrderToExp();

            IList <ProductOrder> products = new List <ProductOrder>();

            foreach (Order o in ordersToExp)
            {
                IList <ProductOrder> productsByOrder = productOrderDao.GetAllByOrder(o);
                foreach (ProductOrder p in productsByOrder)
                {
                    products.Add(p);
                }
            }

            Order order = orderDao.GetById(orderId);

            ViewBag.Order      = order;
            ViewBag.TotalPrice = order.TotalPrice;

            return(View(products));
        }
 public static Collection <ProductOrderModel> GetAllResults()
 {
     db = new Database();
     return(ProductOrderDao.LoadAll(db));
 }