Пример #1
0
        public ActionResult Edit([Bind(Include =
                                           " OrderDetailId"
                                           + ",OrderId"
                                           + ",Quantity"
                                           + ",CatalogItemId"
                                           + ",Price"
                                           + ",SpecialInstructions"
                                           + ",DiscountPercent"
                                       )] OrderDetail OrderDetail)
        {
            OrderDetail oOrderDetail = new OrderDetail();

            oOrderDetail.OrderDetailId = System.Convert.ToInt32(OrderDetail.OrderDetailId);
            oOrderDetail = OrderDetailData.Select_Record(OrderDetail);

            if (ModelState.IsValid)
            {
                bool bSucess = false;
                bSucess = OrderDetailData.Update(oOrderDetail, OrderDetail);
                if (bSucess == true)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError("", "Can Not Update");
                }
            }
            // ComboBox
            ViewData["OrderId"]       = new SelectList(OrderDetail_OrderHeaderData.List(), "OrderId", "OrderId", OrderDetail.OrderId);
            ViewData["CatalogItemId"] = new SelectList(OrderDetail_CatalogItemData.List(), "CatalogItemId", "CatalogItemId", OrderDetail.CatalogItemId);

            return(View(OrderDetail));
        }
Пример #2
0
        public ActionResult Create([Bind(Include =
                                             "OrderId"
                                             + "," + "Quantity"
                                             + "," + "CatalogItemId"
                                             + "," + "Price"
                                             + "," + "SpecialInstructions"
                                             + "," + "DiscountPercent"
                                         )] OrderDetail OrderDetail)
        {
            if (ModelState.IsValid)
            {
                bool bSucess = false;
                bSucess = OrderDetailData.Add(OrderDetail);
                if (bSucess == true)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError("", "Can Not Insert");
                }
            }
            // ComboBox
            ViewData["OrderId"]       = new SelectList(OrderDetail_OrderHeaderData.List(), "OrderId", "OrderId", OrderDetail.OrderId);
            ViewData["CatalogItemId"] = new SelectList(OrderDetail_CatalogItemData.List(), "CatalogItemId", "CatalogItemId", OrderDetail.CatalogItemId);

            return(View(OrderDetail));
        }
Пример #3
0
        // GET: /OrderDetail/Edit/<id>
        public ActionResult Edit(
            Int32?OrderDetailId
            )
        {
            if (
                OrderDetailId == null
                )
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            OrderDetail OrderDetail = new OrderDetail();

            OrderDetail.OrderDetailId = System.Convert.ToInt32(OrderDetailId);
            OrderDetail = OrderDetailData.Select_Record(OrderDetail);

            if (OrderDetail == null)
            {
                return(HttpNotFound());
            }
            // ComboBox
            ViewData["OrderId"]       = new SelectList(OrderDetail_OrderHeaderData.List(), "OrderId", "OrderId", OrderDetail.OrderId);
            ViewData["CatalogItemId"] = new SelectList(OrderDetail_CatalogItemData.List(), "CatalogItemId", "CatalogItemId", OrderDetail.CatalogItemId);

            return(View(OrderDetail));
        }
Пример #4
0
        // GET: /OrderDetail/Create
        public ActionResult Create()
        {
            // ComboBox
            ViewData["OrderId"]       = new SelectList(OrderDetail_OrderHeaderData.List(), "OrderId", "OrderId");
            ViewData["CatalogItemId"] = new SelectList(OrderDetail_CatalogItemData.List(), "CatalogItemId", "CatalogItemId");

            return(View());
        }