public ActionResult Create( SalesGeneral salGen , FormCollection collection) { fillViewBag(); try { if (salGen == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } salGen.resultInserted = false; salGen = conn.InsertSalesInvoice(salGen); if (salGen.resultInserted == false) { ViewBag.Message("Process failed !"); return(View(salGen)); } return(RedirectToAction("InvoiceList")); // TODO: Add insert logic here } catch { return(View(salGen)); } }
public ActionResult Edit(int?id, string type, SalesGeneral salGen, FormCollection collection) { fillViewBag(); var salesInvoice = conn.getSalInvoiceDetail(id, type); SalesHead shold = salesInvoice.salesHead; List <SalesItem> siOldlist = salesInvoice.salesItemList; try { if (salGen == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } salGen.resultUpdated = false; salGen = conn.UpdateSalesInvoice(salGen, shold, siOldlist); if (salGen.resultUpdated == false) { ViewBag.Message("Process failed !"); return(View(salGen)); } return(RedirectToAction("InvoiceList")); // TODO: Add insert logic here } catch { return(View(salGen)); } }
// GET: Invoice/Create public ActionResult Create() { SalesGeneral sGeneral = new SalesGeneral(); SalesHead sh = new SalesHead(); List <SalesItem> sl = new List <SalesItem>(); SalesItem si = new SalesItem(); si.itemNum = 10; sh.docDate = DateTime.Today; sl.Add(si); SalesItem si2 = new SalesItem(); si2.itemNum = 20; sl.Add(si2); SalesItem si3 = new SalesItem(); si3.itemNum = 30; sl.Add(si3); sh.city = "İstanbul"; sh.currency = "TL"; sh.country = "TR"; sh.docType = "F1"; sGeneral.salesHead = sh; sGeneral.salesItemList = sl; fillViewBag(); return(View(sGeneral)); }
// GET: Invoice/Edit/5 public ActionResult Edit(int?id, string type) { fillViewBag(); SalesGeneral sGeneral = new SalesGeneral(); if (id == null || type == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var salesInvoice = conn.getSalInvoiceDetail(id, type); sGeneral.salesHead = salesInvoice.salesHead; sGeneral.salesItemList = salesInvoice.salesItemList; ViewBag.SalHead = sGeneral.salesHead; ViewBag.SalItemList = sGeneral.salesItemList; if (salesInvoice == null) { return(HttpNotFound()); } return(View(sGeneral)); }