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)); }
// 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)); }
// 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)); }
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); }