// GET: /OrderHeader/Delete/<id> public ActionResult Delete( Int32?OrderId ) { if ( OrderId == null ) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } dtOurCustomer = OrderHeader_OurCustomerData.SelectAll(); dtCustomer = OrderHeader_CustomerData.SelectAll(); OrderHeader OrderHeader = new OrderHeader(); OrderHeader.OrderId = System.Convert.ToInt32(OrderId); OrderHeader = OrderHeaderData.Select_Record(OrderHeader); OrderHeader.OurCustomer = new OurCustomer() { UserId = (Int32)OrderHeader.UserId }; OrderHeader.Customer = new Customer() { CustomerId = (Int32)OrderHeader.CustomerId }; if (OrderHeader == null) { return(HttpNotFound()); } return(View(OrderHeader)); }
// GET: /OrderHeader/Edit/<id> public ActionResult Edit( Int32?OrderId ) { if ( OrderId == null ) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } OrderHeader OrderHeader = new OrderHeader(); OrderHeader.OrderId = System.Convert.ToInt32(OrderId); OrderHeader = OrderHeaderData.Select_Record(OrderHeader); if (OrderHeader == null) { return(HttpNotFound()); } // ComboBox ViewData["UserId"] = new SelectList(OrderHeader_OurCustomerData.List(), "UserId", "UserId", OrderHeader.UserId); ViewData["CustomerId"] = new SelectList(OrderHeader_CustomerData.List(), "CustomerId", "CustomerId", OrderHeader.CustomerId); return(View(OrderHeader)); }
public ActionResult Edit([Bind(Include = " OrderId" + ",UserId" + ",OrderDate" + ",CustomerId" + ",OrderTotal" + ",SalesTax" + ",SalesTaxCode" + ",ShippingCharge" + ",QbUpdated" + ",SalesTaxAmt" + ",DiscountAmount" + ",Status" + ",bTestOrder" )] OrderHeader OrderHeader) { OrderHeader oOrderHeader = new OrderHeader(); oOrderHeader.OrderId = System.Convert.ToInt32(OrderHeader.OrderId); oOrderHeader = OrderHeaderData.Select_Record(OrderHeader); if (ModelState.IsValid) { bool bSucess = false; bSucess = OrderHeaderData.Update(oOrderHeader, OrderHeader); if (bSucess == true) { return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Can Not Update"); } } // ComboBox ViewData["UserId"] = new SelectList(OrderHeader_OurCustomerData.List(), "UserId", "UserId", OrderHeader.UserId); ViewData["CustomerId"] = new SelectList(OrderHeader_CustomerData.List(), "CustomerId", "CustomerId", OrderHeader.CustomerId); return(View(OrderHeader)); }
public ActionResult DeleteConfirmed( Int32?OrderId ) { OrderHeader OrderHeader = new OrderHeader(); OrderHeader.OrderId = System.Convert.ToInt32(OrderId); OrderHeader = OrderHeaderData.Select_Record(OrderHeader); bool bSucess = false; bSucess = OrderHeaderData.Delete(OrderHeader); if (bSucess == true) { return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Can Not Delete"); } return(null); }