示例#1
0
        public ActionResult Edit(InvoiceItem InvoiceItem)
        {
            InvoiceItem oInvoiceItem = new InvoiceItem();

            oInvoiceItem.InvoiceID     = System.Convert.ToInt32(InvoiceItem.InvoiceID);
            oInvoiceItem.InvoiceItemID = System.Convert.ToInt32(InvoiceItem.InvoiceItemID);
            oInvoiceItem = InvoiceItemData.Select_Record(InvoiceItem);

            if (ModelState.IsValid)
            {
                bool bSucess = false;
                bSucess = InvoiceItemData.Update(oInvoiceItem, InvoiceItem);
                if (bSucess == true)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError("", "Can Not Update");
                }
            }
            // ComboBox
            ViewData["InvoiceID"] = new SelectList(InvoiceItem_InvoiceData.List(), "InvoiceID", "InvoiceID", InvoiceItem.InvoiceID);

            return(View(InvoiceItem));
        }
示例#2
0
        // GET: /InvoiceItem/Delete/<id>
        public ActionResult Delete(
            Int32?InvoiceID
            , Int32?InvoiceItemID
            )
        {
            if (
                InvoiceID == null ||
                InvoiceItemID == null
                )
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            dtInvoice = InvoiceItem_InvoiceData.SelectAll();

            InvoiceItem InvoiceItem = new InvoiceItem();

            InvoiceItem.InvoiceID     = System.Convert.ToInt32(InvoiceID);
            InvoiceItem.InvoiceItemID = System.Convert.ToInt32(InvoiceItemID);
            InvoiceItem         = InvoiceItemData.Select_Record(InvoiceItem);
            InvoiceItem.Invoice = new Invoice()
            {
                InvoiceID = (Int32)InvoiceItem.InvoiceID
            };

            if (InvoiceItem == null)
            {
                return(HttpNotFound());
            }
            return(View(InvoiceItem));
        }
示例#3
0
        // GET: /InvoiceItem/Edit/<id>
        public ActionResult Edit(
            Int32?InvoiceID
            , Int32?InvoiceItemID
            )
        {
            if (
                InvoiceID == null ||
                InvoiceItemID == null
                )
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            InvoiceItem InvoiceItem = new InvoiceItem();

            InvoiceItem.InvoiceID     = System.Convert.ToInt32(InvoiceID);
            InvoiceItem.InvoiceItemID = System.Convert.ToInt32(InvoiceItemID);
            InvoiceItem = InvoiceItemData.Select_Record(InvoiceItem);

            if (InvoiceItem == null)
            {
                return(HttpNotFound());
            }
            // ComboBox
            ViewData["InvoiceID"] = new SelectList(InvoiceItem_InvoiceData.List(), "InvoiceID", "InvoiceID", InvoiceItem.InvoiceID);

            return(View(InvoiceItem));
        }
示例#4
0
        public ActionResult DeleteConfirmed(
            Int32?InvoiceID
            , Int32?InvoiceItemID
            )
        {
            InvoiceItem InvoiceItem = new InvoiceItem();

            InvoiceItem.InvoiceID     = System.Convert.ToInt32(InvoiceID);
            InvoiceItem.InvoiceItemID = System.Convert.ToInt32(InvoiceItemID);
            InvoiceItem = InvoiceItemData.Select_Record(InvoiceItem);

            bool bSucess = false;

            bSucess = InvoiceItemData.Delete(InvoiceItem);
            if (bSucess == true)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                ModelState.AddModelError("", "Can Not Delete");
            }
            return(null);
        }